static private CreateValueDescriptor ( |
||
memberInfo | ||
attr | MigraDoc.DocumentObjectModel.Internals.DVAttribute | |
리턴 |
/// <summary> /// Adds a value descriptor for each field and property found in type to meta. /// </summary> static void AddValueDescriptors(Meta meta, Type type) { #if !NETFX_CORE FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); #else var fieldInfos = type.GetTypeInfo().DeclaredFields; #endif foreach (FieldInfo fieldInfo in fieldInfos) { #if DEBUG_ string name = fieldInfo.Name; if (name == "parent") { name.GetType(); } #endif DVAttribute[] dvs = (DVAttribute[])fieldInfo.GetCustomAttributes(typeof(DVAttribute), false); if (dvs.Length == 1) { ValueDescriptor vd = ValueDescriptor.CreateValueDescriptor(fieldInfo, dvs[0]); meta.ValueDescriptors.Add(vd); } } #if !NETFX_CORE PropertyInfo[] propInfos = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); #else var propInfos = type.GetTypeInfo().DeclaredProperties; #endif foreach (PropertyInfo propInfo in propInfos) { #if DEBUG_ string name = propInfo.Name; if (name == "Font") { name.GetType(); } #endif DVAttribute[] dvs = (DVAttribute[])propInfo.GetCustomAttributes(typeof(DVAttribute), false); if (dvs.Length == 1) { ValueDescriptor vd = ValueDescriptor.CreateValueDescriptor(propInfo, dvs[0]); meta.ValueDescriptors.Add(vd); } } }