/// <summary> /// This method is public for the compiler to generate faster code by directly manipulating the map when needed /// </summary> public PropertyMap AddOwnProperty(string field, int fieldId, PropertyDescriptor.Attributes attributes) { Debug.Assert(fieldId != Runtime.InvalidFieldId, "Invalid situation! FieldId of {0} is not assigned", field); Debug.Assert(GetOwnPropertyDescriptorByFieldId(fieldId) == null, "Invalid situation! Field {0} alread exists in the map", field); PropertyMap newMap = null; if (_children == null) { _children = new Dictionary <int, PropertyMap>(); } int key = ((int)attributes << 16) | (fieldId & 0xFFFF); if (!_children.TryGetValue(key, out newMap)) { var overridenProperty = Metadata.GetInheritedPropertyDescriptorByFieldId(fieldId); newMap = new PropertyMap(Metadata, this, new PropertyDescriptor(field, fieldId, this.Property.Index + 1, attributes), overridenProperty); _children[key] = newMap; } return(newMap); }