public CustomPropertyDescriptor(CustomProperty customProperty, CustomTypeDescriptorBag customTypeDescriptor) : base(customProperty.Name, customProperty.Attributes) { m_CustomProperty = customProperty; m_CustomTypeDescriptor = customTypeDescriptor; this.IfcPropertyName = customProperty.IfcPropertyName; this.IfcPropertyGlobalId = customProperty.IfcPropertyGlobalId; }
public override System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { System.ComponentModel.ICustomTypeDescriptor defaultTypeDescriptor = base.GetTypeDescriptor(objectType, instance); if (instance == null) { return(defaultTypeDescriptor); } System.ComponentModel.ICustomTypeDescriptor customTypeDescriptor; if (m_ICustomTypeDescriptorCollectionByHashCode.TryGetValue(instance.GetHashCode(), out customTypeDescriptor)) { return(customTypeDescriptor); } customTypeDescriptor = new CustomTypeDescriptorBag(defaultTypeDescriptor, instance); m_ICustomTypeDescriptorCollectionByHashCode.Add(instance.GetHashCode(), customTypeDescriptor); //if (instance != null) // System.Diagnostics.Debug.WriteLine("HashCode: " + instance.GetHashCode()); return(customTypeDescriptor); }