AddSchemaPropertiesToDictionary static method

void AddSchemaPropertiesToDictionary(
  1. Type type,
  2. Map<String, PropertyDefinitionBase> propDefDictionary
)
Call delegate for each public static PropertyDefinition field in type. The type. The property field delegate. Adds schema properties to dictionary. Schema type. The property definition dictionary.

Implementation

//        static void ForeachPublicStaticPropertyFieldInType(Type type, PropertyFieldInfoDelegate propFieldDelegate)
//        {
//            FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly);
//
//            for (FieldInfo fieldInfo in fieldInfos)
//            {
//                if (fieldInfo.FieldType == typeof(PropertyDefinition) || fieldInfo.FieldType.IsSubclassOf(typeof(PropertyDefinition)))
//                {
//                    PropertyDefinition propertyDefinition = (PropertyDefinition)fieldInfo.GetValue(null);
//                    propFieldDelegate(propertyDefinition, fieldInfo);
//                }
//            }
//        }

/// <summary>
/// Adds schema properties to dictionary.
/// </summary>
/// <param name="type">Schema type.</param>
/// <param name="propDefDictionary">The property definition dictionary.</param>
static void AddSchemaPropertiesToDictionary(
  Type type,
  Map<String, PropertyDefinitionBase> propDefDictionary,
) {
  //            ServiceObjectSchema.ForeachPublicStaticPropertyFieldInType(
  //                type,
  //                (propertyDefinition, fieldInfo) {
  //                    // Some property definitions descend from ServiceObjectPropertyDefinition but don't have
  //                    // a Uri, like ExtendedProperties. Ignore them.
  //                    if (propertyDefinition.Uri != null && propertyDefinition.Uri.isNotEmpty))
  //                    {
  //                        PropertyDefinitionBase existingPropertyDefinition;
  //                        if (propDefDictionary.TryGetValue(propertyDefinition.Uri, out existingPropertyDefinition))
  //                        {
  //                            EwsUtilities.Assert(
  //                                existingPropertyDefinition == propertyDefinition,
  //                                "Schema.allSchemaProperties.delegate",
  //                                string.Format("There are at least two distinct property definitions with the following URI: {0}", propertyDefinition.Uri));
  //                        }
  //                        else
  //                        {
  //                            propDefDictionary.Add(propertyDefinition.Uri, propertyDefinition);
  //
  //                            // The following is a "generic hack" to register properties that are not public and
  //                            // thus not returned by the above GetFields call. It is currently solely used to register
  //                            // the MeetingTimeZone property.
  //                            List<PropertyDefinition> associatedInternalProperties = propertyDefinition.GetAssociatedInternalProperties();
  //
  //                            for (PropertyDefinition associatedInternalProperty in associatedInternalProperties)
  //                            {
  //                                propDefDictionary.Add(associatedInternalProperty.Uri, associatedInternalProperty);
  //                            }
  //                        }
  //                    }
  //                });
}