コード例 #1
0
 private static void AddFieldReflection(FieldInfo fieldInfo, ICollection <SerializedFieldReflection> fieldReflections)
 {
     object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(SerializedAttribute), inherit: true);
     if (customAttributes.Length > 0)
     {
         SerializedAttribute serializedAttribute = (SerializedAttribute)customAttributes[0];
         AddFieldReflection(fieldInfo, fieldReflections, serializedAttribute.PrimaryId);
         byte[] alternateIds = serializedAttribute.AlternateIds;
         foreach (byte id in alternateIds)
         {
             AddFieldReflection(fieldInfo, fieldReflections, id);
         }
     }
 }
コード例 #2
0
        private static void AddType(Type type)
        {
            SerializedAttribute serializedAttribute = GetSerializedAttribute(type);

            if (serializedAttribute != null)
            {
                AssertNewType(type, serializedAttribute.PrimaryId);
                AssertTypeExtendsAbstractDocument(type);
                SerializedTypeReflection value = AddType(type, serializedAttribute.PrimaryId);
                byte[] alternateIds            = serializedAttribute.AlternateIds;
                foreach (byte key in alternateIds)
                {
                    typeReflectionsById.Add(key, value);
                }
            }
        }