private static void FillValueToObject(PropertyInfo propertyInfo, object objectData, string attribute) { Type propertyType = propertyInfo.PropertyType; object value = null; if (propertyType.IsEnum) { value = EnumConvertor.ReadData(propertyType, attribute); } else { value = ValueConvertor.ReadData(propertyType, attribute); } if (null != value) { propertyInfo.SetValue(objectData, value); } }
public SerializableMap(SerializationInfo info, StreamingContext context) { this._innerCollection = new Dictionary <TKey, TValue>(UtilityConstants.DefaultEntityCount); SerializationInfoEnumerator enumerator = info.GetEnumerator(); while (enumerator.MoveNext()) { TKey key; Type keyType = typeof(TKey); if (keyType.IsEnum) { key = (TKey)EnumConvertor.ReadData(keyType, enumerator.Name); } else { key = (TKey)ValueConvertor.ReadData(keyType, enumerator.Name); } this._innerCollection.Add(key, (TValue)enumerator.Value); } }