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

GetBool() public method

public GetBool ( string key ) : bool
key string
return bool
        public bool GetBool(string key)
        {
            Object value = GetObjectProperty(key);

            try
            {
                if(value is Boolean)
                {
                    return (bool) value;
                }
                else if(value is String)
                {
                    return ((string) value).ToLower() == "true";
                }
                else
                {
                    throw new MessageFormatException(" cannot read a boolean from " + value.GetType().Name);
                }
            }
            catch(FormatException ex)
            {
                throw NMSExceptionSupport.CreateMessageFormatException(ex);
            }
        }