public override string ToString() { string memberName; if (this._memberType) { memberName = this._propertyInfo.Name; } else { memberName = this._fieldInfo.Name; } return($"{memberName}_{TTLVType.ToString()}_{TypeCode.ToString()}_{Tag}"); }
/// <summary> /// /// </summary> /// <param name="collectionType"></param> /// <param name="eleType"></param> /// <param name="ttlvType"></param> public static void GetCollectionElementType(Type collectionType, out Type eleType, out TTLVType ttlvType) { if (collectionType.IsArray) { ttlvType = TTLVType.Array; eleType = collectionType.GetElementType(); } else if (collectionType.GetInterface(typeof(IList).FullName) != null) { ttlvType = TTLVType.IList; //eleType = propertyInfo.PropertyType.GenericTypeArguments[0];//4.5支持此种用法,4.0不支持 eleType = collectionType.GetGenericArguments()[0]; } else { throw new NotImplementedException($"集合类型[{collectionType.FullName}]不支持TTLV编码"); } }