Apache.NMS.Util.PrimitiveMapInterceptor.GetLong C# (CSharp) Method

GetLong() public method

public GetLong ( string key ) : long
key string
return long
        public long GetLong(string key)
        {
            Object value = GetObjectProperty(key);

            try
            {
                if(value is Int64)
                {
                    return (long) value;
                }
                else if(value is Int32 || value is Int16 || value is Byte || value is String)
                {
                    return Convert.ToInt64(value);
                }
                else
                {
                    throw new MessageFormatException(" cannot read a long from " + value.GetType().Name);
                }
            }
            catch(FormatException ex)
            {
                throw NMSExceptionSupport.CreateMessageFormatException(ex);
            }
        }