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

GetShort() public method

public GetShort ( string key ) : short
key string
return short
        public short GetShort(string key)
        {
            Object value = GetObjectProperty(key);

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