internal FastDeepClonerProperty(PropertyInfo property) { CanRead = !(!property.CanWrite || !property.CanRead || property.PropertyType == typeof(IntPtr) || property.GetIndexParameters().Length > 0); FastDeepClonerIgnore = property.GetCustomAttribute <FastDeepClonerIgnore>() != null; _propertyGet = property.GetValue; _propertySet = property.SetValue; Attributes = new AttributesCollections(property.GetCustomAttributes().ToList()); Name = property.Name; FullName = property.PropertyType.FullName; PropertyType = property.PropertyType; IsInternalType = property.PropertyType.IsInternalType(); IsVirtual = property.GetMethod.IsVirtual; PropertyGetValue = property.GetMethod; PropertySetValue = property.SetMethod; if (ContainAttribute <KnownType>()) { if (PropertyType != PropertyType.GetActualType()) { PropertyType = typeof(List <>).MakeGenericType(GetCustomAttribute <KnownType>().ObjectType); } else { PropertyType = GetCustomAttribute <KnownType>().ObjectType; } } }
internal FastDeepClonerProperty(FieldInfo field) { CanRead = !(field.IsInitOnly || field.FieldType == typeof(IntPtr) || field.IsLiteral); CanReadWrite = CanRead; CanWrite = CanRead; FastDeepClonerIgnore = field.GetCustomAttribute <FastDeepClonerIgnore>() != null; Attributes = new AttributesCollections(field.GetCustomAttributes().ToList()); _propertyGet = field.GetValue; _propertySet = field.SetValue; Name = field.Name; FullName = field.FieldType.FullName; PropertyType = field.FieldType; IsInternalType = field.FieldType.IsInternalType(); if (ContainAttribute <KnownType>()) { if (PropertyType != PropertyType.GetActualType()) { PropertyType = typeof(List <>).MakeGenericType(GetCustomAttribute <KnownType>().ObjectType); } else { PropertyType = GetCustomAttribute <KnownType>().ObjectType; } } }
internal FastDeepClonerProperty(FieldInfo field) { CanRead = !(field.IsInitOnly || field.FieldType == typeof(IntPtr) || field.IsLiteral); FastDeepClonerIgnore = field.GetCustomAttribute <FastDeepClonerIgnore>() != null; Attributes = new AttributesCollections(field.GetCustomAttributes().ToList()); _propertyGet = field.GetValue; _propertySet = field.SetValue; Name = field.Name; FullName = field.FieldType.FullName; PropertyType = field.FieldType; IsInternalType = field.FieldType.IsInternalType(); }
internal FastDeepClonerProperty(PropertyInfo property) { CanRead = !(!property.CanWrite || !property.CanRead || property.PropertyType == typeof(IntPtr) || property.GetIndexParameters().Length > 0); FastDeepClonerIgnore = property.GetCustomAttribute <FastDeepClonerIgnore>() != null; _propertyGet = property.GetValue; _propertySet = property.SetValue; Attributes = new AttributesCollections(property.GetCustomAttributes().ToList()); Name = property.Name; FullName = property.PropertyType.FullName; PropertyType = property.PropertyType; IsInternalType = property.PropertyType.IsInternalType(); IsVirtual = property.GetMethod.IsVirtual; PropertyGetValue = property.GetMethod; PropertySetValue = property.SetMethod; }