コード例 #1
0
 public object this[string name]
 {
     get
     {
         Parse();
         if (FieldIndex.TryGetValue(name, out int index))
         {
             return(Fields[index].Value);
         }
         return(null);
     }
 }
コード例 #2
0
 public MessageStruct Struct(string name)
 {
     Parse();
     if (FieldIndex.TryGetValue(name, out int index))
     {
         MemberParserType fieldType = Fields[index].Type;
         if (fieldType == MemberParserType.Struct || fieldType == MemberParserType.Vector)
         {
             return((MessageStruct)Fields[index].Value);
         }
     }
     return(null);
 }
コード例 #3
0
        public T Value <T>(string name) where T : IConvertible
        {
            Parse();
            T result = default(T);

            if (FieldIndex.TryGetValue(name, out int index))
            {
                IConvertible c = Fields[index].Value as IConvertible;
                result = (T)c.ToType(typeof(T), CultureInfo.CurrentCulture);
                //result = (T)Fields[index].Value;
            }
            return(result);
        }