public object this[string name] { get { Parse(); if (FieldIndex.TryGetValue(name, out int index)) { return(Fields[index].Value); } return(null); } }
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); }
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); }