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

GetChar() public method

public GetChar ( string key ) : char
key string
return char
        public char GetChar(string key)
        {
            Object value = GetObjectProperty(key);

            try
            {
                if(value is Char)
                {
                    return (char) value;
                }
                else if(value is String)
                {
                    string svalue = value as string;
                    if(svalue.Length == 1)
                    {
                        return svalue.ToCharArray()[0];
                    }
                }

                throw new MessageFormatException(" cannot read a char from " + value.GetType().Name);
            }
            catch(FormatException ex)
            {
                throw NMSExceptionSupport.CreateMessageFormatException(ex);
            }
        }