當前位置: 首頁>>代碼示例>>C#>>正文


C# ComponentModel.PropertyDescriptorCollection類代碼示例

本文整理匯總了C#中System.ComponentModel.PropertyDescriptorCollection的典型用法代碼示例。如果您正苦於以下問題:C# PropertyDescriptorCollection類的具體用法?C# PropertyDescriptorCollection怎麽用?C# PropertyDescriptorCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PropertyDescriptorCollection類屬於System.ComponentModel命名空間,在下文中一共展示了PropertyDescriptorCollection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetProperties

		public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null);
			foreach (PropertyDescriptor parent in TypeDescriptor.GetProperties(this.component, attributes, false))
				descriptorCollection.Add((PropertyDescriptor)new ReadOnlyPropertyDescriptor(parent));
			return descriptorCollection;
		}
開發者ID:smther,項目名稱:FreeOQ,代碼行數:7,代碼來源:ReadOnlyTypeDescriptor.cs

示例2: AddProperty

        public PropertyDescriptorCollection AddProperty(PropertyDescriptorCollection pdc, string propertyName, Type propertyType, TypeConverter converter,
            Attribute[] attributes)
        {
            List<PropertyDescriptor> properties = new List<PropertyDescriptor>(pdc.Count);

            for (int i = 0; i < pdc.Count; i++)
            {
                PropertyDescriptor pd = pdc[i];

                if (pd.Name != propertyName)
                {
                    properties.Add(pd);
                }
            }

            InstanceSavePropertyDescriptor ppd = new InstanceSavePropertyDescriptor(
                propertyName, propertyType, attributes);

            ppd.TypeConverter = converter;

            properties.Add(ppd);

            //PropertyDescriptor propertyDescriptor;

            return new PropertyDescriptorCollection(properties.ToArray());
        }
開發者ID:jiailiuyan,項目名稱:Gum,代碼行數:26,代碼來源:PropertyDescriptorHelper.cs

示例3: ComponentExporter

        private ComponentExporter(Type inputType, PropertyDescriptorCollection properties) : 
            base(inputType)
        {
            Debug.Assert(properties != null);
            
            _properties = properties;

            int index = 0;
            int count = 0;
            IObjectMemberExporter[] exporters = new IObjectMemberExporter[properties.Count];

            foreach (PropertyDescriptor property in properties)
            {
                IServiceProvider sp = property as IServiceProvider;
                
                if (sp == null)
                    continue;
                
                IObjectMemberExporter exporter = (IObjectMemberExporter) sp.GetService(typeof(IObjectMemberExporter));
                
                if (exporter == null)
                    continue;
                
                exporters[index++] = exporter;
                count++;
            }
            
            if (count > 0)
                _exporters = exporters;
        }
開發者ID:BackupTheBerlios,項目名稱:jayrock-svn,代碼行數:30,代碼來源:ComponentExporter.cs

示例4: Half2Converter

 /// <summary>
 ///   Initializes a new instance of the <see cref = "T:SiliconStudio.Core.TypeConverters.Half2Converter" /> class.
 /// </summary>
 public Half2Converter()
 {
     Type type = typeof (Half2);
     PropertyDescriptor[] propArray = new PropertyDescriptor[]
                                          {new FieldPropertyDescriptor(type.GetField("X")), new FieldPropertyDescriptor(type.GetField("Y"))};
     properties = new PropertyDescriptorCollection(propArray);
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:10,代碼來源:Half2Converter.cs

示例5: GetProperties

 public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     var pdl = propertyDescriptorList.FindAll(pd => pd.Attributes.Contains(attributes));
     PreProcess(pdl);
     var pdcReturn = new PropertyDescriptorCollection(pdl.ToArray());
     return pdcReturn;
 }
開發者ID:ssuing8825,項目名稱:ServiceBusExplorer,代碼行數:7,代碼來源:DynamicCustomTypeDescriptor.cs

示例6: GetProperties

        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            //var cols = base.GetProperties();
            var props = new PropertyDescriptorCollection(null);

            foreach (FieldInfo fi in value.GetType().GetFields())
            {
                var prop = new WsdlFieldDescriptor(fi, attributes);
                props.Add(prop);
                if (fi.FieldType.BaseType.FullName == "System.Array")
                {
                    TypeDescriptor.AddAttributes(fi.FieldType, new TypeConverterAttribute(typeof(ArrayConverter)));
                    Type elemType = fi.FieldType.GetElementType();
                    TypeDescriptorModifier.modifyType(elemType);
                }
                else if (fi.FieldType.BaseType.FullName == "System.Enum")
                {
                }
                else
                {
                    TypeDescriptorModifier.modifyType(fi.FieldType);
                }
            }

            if (props.Count > 0)
                return props;

            return base.GetProperties(context, value, attributes);
        }
開發者ID:nkarastamatis,項目名稱:WebServiceTestStudio_Winforms,代碼行數:29,代碼來源:WsdlObjectConverter.cs

示例7: ConfigurationTypeDescriptor

        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationTypeDescriptor"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        public ConfigurationTypeDescriptor(object value)
        {
            this.value = value;
            var descriptors = new List<PropertyDescriptor>();

            if (value != null)
            {
                var type = this.value.GetType();

                // Get all the fields
                var fields = type.GetFields();
                foreach (var field in fields)
                {
                    var name = this.GetReflectionName(field);
                    if (name != null)
                    {
                        descriptors.Add(new FieldPropertyDescriptor(name, field, this.value));
                    }
                }

                // Get all the properties
                var properties = type.GetProperties();
                foreach (var property in properties)
                {
                    var name = this.GetReflectionName(property);
                    if (name != null)
                    {
                        descriptors.Add(new PropertyPropertyDescriptor(name, property, this.value));
                    }
                }
            }

            this.properties = new PropertyDescriptorCollection(descriptors.ToArray(), true);
        }
開發者ID:kascomp,項目名稱:CruiseControl.NET,代碼行數:38,代碼來源:ConfigurationTypeDescriptor.cs

示例8: Find

		public void Find ()
		{
			PropertyDescriptor descA = new MockPropertyDescriptor ("hehe_\u0061\u030a", 2);
			PropertyDescriptor descB = new MockPropertyDescriptor ("heh_\u00e5", 3);
			PropertyDescriptor descC = new MockPropertyDescriptor ("Foo", 5);
			PropertyDescriptor descD = new MockPropertyDescriptor ("FOo", 6);
			PropertyDescriptor descE = new MockPropertyDescriptor ("Aim", 1);
			PropertyDescriptor descF = new MockPropertyDescriptor ("Bar", 4);

			PropertyDescriptorCollection col = new PropertyDescriptorCollection (
				new PropertyDescriptor [] { descA, descB, descC, descD, descE, descF });

			Assert.IsNull (col.Find ("heh_\u0061\u030a", false), "#1");
			Assert.IsNull (col.Find ("hehe_\u00e5", false), "#2");
			Assert.AreSame (descA, col.Find ("hehe_\u0061\u030a", false), "#3");
			Assert.AreSame (descB, col.Find ("heh_\u00e5", false), "#4");
			Assert.IsNull (col.Find ("foo", false), "#5");
			Assert.AreSame (descC, col.Find ("foo", true), "#6");
			Assert.AreSame (descD, col.Find ("FOo", false), "#7");
			Assert.AreSame (descC, col.Find ("FOo", true), "#8");
			Assert.IsNull (col.Find ("fOo", false), "#9");
			Assert.AreSame (descC, col.Find ("fOo", true), "#10");
			Assert.IsNull (col.Find ("AIm", false), "#11");
			Assert.AreSame (descE, col.Find ("AIm", true), "#12");
			Assert.IsNull (col.Find ("AiM", false), "#13");
			Assert.AreSame (descE, col.Find ("AiM", true), "#14");
			Assert.AreSame (descE, col.Find ("Aim", false), "#15");
			Assert.AreSame (descE, col.Find ("Aim", true), "#16");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:29,代碼來源:PropertyDescriptorCollectionTests.cs

示例9: GetProperties

        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            //var cols = base.GetProperties();
            var props = new PropertyDescriptorCollection(null);

            foreach (FieldInfo fi in value.GetType().GetFields())
            {
                var prop = new MyPropertyDesciptor(fi, attributes);
                props.Add(prop);
                if (fi.FieldType.Namespace == "System.Collections.Generic")
                {
                    Type[] args = fi.FieldType.GetGenericArguments();
                    foreach (Type arg in args)
                        MyCustomTypeDescriptor.modifyNonSystemTypes(arg);
                }

                {
                    MyCustomTypeDescriptor.modifyNonSystemTypes(fi.FieldType);
                }
            }

            if (props.Count > 0)
                return props;

            return base.GetProperties(context, value, attributes);
        }
開發者ID:nkarastamatis,項目名稱:FieldsGrid,代碼行數:26,代碼來源:MyObjectShell.cs

示例10: DescriptorBase

 /// <summary>
 /// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="parentdescriptor">The parentdescriptor.</param>
 /// <param name="objectType">Type of the object.</param>
 public DescriptorBase(ShapeProvider provider, ICustomTypeDescriptor parentdescriptor, Type objectType)
     : base(parentdescriptor)
 {
     this.provider = provider;
     this.type = objectType;
     mProperties = new PropertyDescriptorCollection(null);
 }
開發者ID:JackWangCUMT,項目名稱:mathnet-yttrium,代碼行數:13,代碼來源:DescriptorBase.cs

示例11: GetProperties

		public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null);
			foreach (PropertyDescriptor parent in TypeDescriptor.GetProperties((object) this.provider.UserProvider, attributes, false))
				descriptorCollection.Add((PropertyDescriptor)new FQProviderPropertyDescriptor(parent));
			return descriptorCollection;
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:7,代碼來源:FQProviderTypeDescriptor.cs

示例12: GetProperties

		public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null);
			foreach (ScriptProperty property in this.settings.ScriptProperties.Values)
				descriptorCollection.Add((PropertyDescriptor)new ScriptPropertyDescriptor(property));
			return descriptorCollection;
		}
開發者ID:smther,項目名稱:FreeOQ,代碼行數:7,代碼來源:ScriptSettingsTypeDescriptor.cs

示例13: DataRecordInternal

 // copy all runtime data information
 internal DataRecordInternal(object[] values, PropertyDescriptorCollection descriptors, FieldNameLookup fieldNameLookup)
 {
     Debug.Assert(null != values, "invalid attempt to instantiate DataRecordInternal with null value[]");
     _values = values;
     _propertyDescriptors = descriptors;
     _fieldNameLookup = fieldNameLookup;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:8,代碼來源:DataRecordInternal.cs

示例14: FFTypeDescriptor

        public FFTypeDescriptor([NotNull]object targetObject)
        {
            _WrappedObject = targetObject;

            Type type = targetObject.GetType();
            PropertyDescriptorCollection pdc;
            if (!__TypedDescriptorCollection.TryGetValue(type, out pdc))
            {
                pdc = new PropertyDescriptorCollection(null);
                foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(type))
                {
                    var desc = new MyPropDesc(pd);
                    desc.ValueChanging += Property_ValueChanging;
                    pdc.Add(desc);
                }
                foreach (BindPropertyAttribute a in type.GetCustomAttributes<BindPropertyAttribute>())
                {
                    var childProp = a.GetSourcePropertyInfo(type);
                    var v = childProp.GetValue(targetObject, null);
                    var pdcs = TypeDescriptor.GetProperties(v, false);
                    var bpd = new BindPropertyDescriptor(pdcs[a.Property], childProp, a.DisplayName, a.Description, a.Category);
                    bpd.ValueChanging += Property_ValueChanging;
                    pdc.Add(bpd);
                }
   
                __TypedDescriptorCollection.Add(type, pdc);
            }
            _DescriptorCollection = pdc;
        }
開發者ID:supermuk,項目名稱:iudico,代碼行數:29,代碼來源:PropertyGridUtils.cs

示例15: MatrixConverter

 /// <summary>Initializes a new instance of the MatrixConverter class.</summary>
 public MatrixConverter()
 {
     var componentType = typeof(Matrix);
     var properties = TypeDescriptor.GetProperties(componentType);
     var descriptors =
         new PropertyDescriptorCollection(new PropertyDescriptor[]
         {
             properties.Find("Translation", true), new FieldPropertyDescriptor(componentType.GetField("M11")),
             new FieldPropertyDescriptor(componentType.GetField("M12")),
             new FieldPropertyDescriptor(componentType.GetField("M13")),
             new FieldPropertyDescriptor(componentType.GetField("M14")),
             new FieldPropertyDescriptor(componentType.GetField("M21")),
             new FieldPropertyDescriptor(componentType.GetField("M22")),
             new FieldPropertyDescriptor(componentType.GetField("M23")),
             new FieldPropertyDescriptor(componentType.GetField("M24")),
             new FieldPropertyDescriptor(componentType.GetField("M31")),
             new FieldPropertyDescriptor(componentType.GetField("M32")),
             new FieldPropertyDescriptor(componentType.GetField("M33")),
             new FieldPropertyDescriptor(componentType.GetField("M34")),
             new FieldPropertyDescriptor(componentType.GetField("M41")),
             new FieldPropertyDescriptor(componentType.GetField("M42")),
             new FieldPropertyDescriptor(componentType.GetField("M43")),
             new FieldPropertyDescriptor(componentType.GetField("M44"))
         });
     propertyDescriptions = descriptors;
     supportStringConvert = false;
 }
開發者ID:Gartley,項目名稱:ss13remake,代碼行數:28,代碼來源:MatrixConverter.cs


注:本文中的System.ComponentModel.PropertyDescriptorCollection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。