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

GetInt() public method

public GetInt ( string key ) : int
key string
return int
        public int GetInt(string key)
        {
            Object value = GetObjectProperty(key);

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