当前位置: 首页>>代码示例>>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;未经允许,请勿转载。