当前位置: 首页>>代码示例>>C#>>正文


C# PropertyDescriptorCollection.Sort方法代码示例

本文整理汇总了C#中System.ComponentModel.PropertyDescriptorCollection.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDescriptorCollection.Sort方法的具体用法?C# PropertyDescriptorCollection.Sort怎么用?C# PropertyDescriptorCollection.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.PropertyDescriptorCollection的用法示例。


在下文中一共展示了PropertyDescriptorCollection.Sort方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetProperties

 public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
 {
     PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null);
     descriptors.Add(new RuleConditionReferenceNamePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "ConditionName", typeof(string), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes })));
     descriptors.Add(new RuleConditionReferencePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "Expression", typeof(CodeExpression), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes })));
     return descriptors.Sort(new string[] { "ConditionName", "Expression" });
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RuleConditionReferenceTypeConverter.cs

示例2: Vector2Converter

 public Vector2Converter()
 {
     Type typeFromHandle = typeof(Vector2);
     PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(new PropertyDescriptor[]
     {
         new FieldPropertyDescriptor(typeFromHandle.GetField("X")),
         new FieldPropertyDescriptor(typeFromHandle.GetField("Y"))
     });
     this.propertyDescriptions = propertyDescriptorCollection.Sort(new string[]
     {
         "X",
         "Y"
     });
 }
开发者ID:absturztaube,项目名称:EngineTK,代码行数:14,代码来源:Vector2Converter.cs

示例3: RectangleFConverter

 public RectangleFConverter()
 {
     Type typeFromHandle = typeof(RectangleF);
     PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(new PropertyDescriptor[]
     {
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("X")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("Y")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("Width")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("Height"))
     });
     this.propertyDescriptions = propertyDescriptorCollection.Sort(new string[]
     {
         "X",
         "Y",
         "Width",
         "Height"
     });
 }
开发者ID:absturztaube,项目名称:EngineTK,代码行数:18,代码来源:RectangleFConverter.cs

示例4: ColorConverter

 public ColorConverter()
 {
     Type typeFromHandle = typeof(Color);
     PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(new PropertyDescriptor[]
     {
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("R")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("G")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("B")),
         new PropertyPropertyDescriptor(typeFromHandle.GetProperty("A"))
     });
     this.propertyDescriptions = propertyDescriptorCollection.Sort(new string[]
     {
         "R",
         "G",
         "B",
         "A"
     });
 }
开发者ID:absturztaube,项目名称:EngineTK,代码行数:18,代码来源:ColorConverter.cs

示例5: SortProperties

		protected PropertyDescriptorCollection SortProperties (PropertyDescriptorCollection props, string[] names)
		{
			props.Sort (names);
			return props; 
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:TypeConverter.cs

示例6: GetChildProperties

        public override PropertyDescriptorCollection GetChildProperties( object instance, Attribute[] filter )
        {
            PropertyDescriptorCollection pdc = null;
            var tc = this.Converter;
            if (tc.GetPropertiesSupported(null) == false)
            {
                pdc = base.GetChildProperties(instance, filter);
            }
            else
            {

            }
            if (propertyDescriptor != null)
            {
                tc = propertyDescriptor.Converter;
            }
            else
            {
                //pdc = base.GetChildProperties(instance, filter);// this gives us a readonly collection, no good
                tc = TypeDescriptor.GetConverter(instance, true);
            }
            if (pdc == null || pdc.Count == 0)
            {
                return pdc;
            }
            if (pdc[0] is CustomPropertyDescriptor)
            {
                return pdc;
            }
            // now wrap these properties with our CustomPropertyDescriptor
            var pdl = new PropertyDescriptorList( );

            foreach (PropertyDescriptor pd in pdc)
            {
                if (pd is CustomPropertyDescriptor)
                {
                    pdl.Add(pd as CustomPropertyDescriptor);
                }
                else
                {
                    pdl.Add(new CustomPropertyDescriptor(instance, pd));
                }
            }

            pdl.Sort(new PropertySorter( ));
            var pdcReturn = new PropertyDescriptorCollection(pdl.ToArray( ));
            pdcReturn.Sort( );
            return pdcReturn;
        }
开发者ID:ssuing8825,项目名称:ServiceBusExplorer,代码行数:49,代码来源:CustomPropertyDescriptor.cs

示例7: Sort

		[Test] // Sort (String [], IComparer)
		public void Sort4 ()
		{
			PropertyDescriptorCollection descriptors;
			PropertyDescriptorCollection sorted;

			PropertyDescriptor descA = new MockPropertyDescriptor ("Foo", 2);
			PropertyDescriptor descB = new MockPropertyDescriptor ("Aim", 3);
			PropertyDescriptor descC = new MockPropertyDescriptor ("Bim", 1);
			PropertyDescriptor descD = new MockPropertyDescriptor ("AIm", 5);
			PropertyDescriptor descE = new MockPropertyDescriptor ("Boo", 4);
			PropertyDescriptor descF = new MockPropertyDescriptor ("FOo", 6);

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

			Assert.AreSame (descA, descriptors [0], "#A1");
			Assert.AreSame (descB, descriptors [1], "#A2");
			Assert.AreSame (descC, descriptors [2], "#A3");
			Assert.AreSame (descD, descriptors [3], "#A4");
			Assert.AreSame (descE, descriptors [4], "#A5");
			Assert.AreSame (descF, descriptors [5], "#A6");

			sorted = descriptors.Sort (new string [] { "B", "Foo", null, "A", "Boo" },
				new ComparableComparer ());

			Assert.AreSame (descA, descriptors [0], "#B1");
			Assert.AreSame (descB, descriptors [1], "#B2");
			Assert.AreSame (descC, descriptors [2], "#B3");
			Assert.AreSame (descD, descriptors [3], "#B4");
			Assert.AreSame (descE, descriptors [4], "#B5");
			Assert.AreSame (descF, descriptors [5], "#B6");

			Assert.AreSame (descA, sorted [0], "#C1");
			Assert.AreSame (descE, sorted [1], "#C2");
			Assert.AreSame (descC, sorted [2], "#C3");
			Assert.AreSame (descB, sorted [3], "#C4");
			Assert.AreSame (descD, sorted [4], "#C5");
			Assert.AreSame (descF, sorted [5], "#C6");

			sorted = descriptors.Sort ((string []) null, new ComparableComparer ());

			Assert.AreSame (descA, descriptors [0], "#D1");
			Assert.AreSame (descB, descriptors [1], "#D2");
			Assert.AreSame (descC, descriptors [2], "#D3");
			Assert.AreSame (descD, descriptors [3], "#D4");
			Assert.AreSame (descE, descriptors [4], "#D5");
			Assert.AreSame (descF, descriptors [5], "#D6");

			Assert.AreSame (descC, sorted [0], "#E1");
			Assert.AreSame (descA, sorted [1], "#E2");
			Assert.AreSame (descB, sorted [2], "#E3");
			Assert.AreSame (descE, sorted [3], "#E4");
			Assert.AreSame (descD, sorted [4], "#E5");
			Assert.AreSame (descF, sorted [5], "#E6");

			sorted = descriptors.Sort (new string [] { "B", "Foo", null, "A", "Boo" },
				(Comparer) null);

			Assert.AreSame (descA, descriptors [0], "#F1");
			Assert.AreSame (descB, descriptors [1], "#F2");
			Assert.AreSame (descC, descriptors [2], "#F3");
			Assert.AreSame (descD, descriptors [3], "#F4");
			Assert.AreSame (descE, descriptors [4], "#F5");
			Assert.AreSame (descF, descriptors [5], "#F6");

			Assert.AreSame (descA, sorted [0], "#G1");
			Assert.AreSame (descE, sorted [1], "#G2");
			Assert.AreSame (descB, sorted [2], "#G3");
			Assert.AreSame (descD, sorted [3], "#G4");
			Assert.AreSame (descC, sorted [4], "#G5");
			Assert.AreSame (descF, sorted [5], "#G6");

			sorted = descriptors.Sort ((string []) null, (Comparer) null);

			Assert.AreSame (descA, descriptors [0], "#H1");
			Assert.AreSame (descB, descriptors [1], "#H2");
			Assert.AreSame (descC, descriptors [2], "#H3");
			Assert.AreSame (descD, descriptors [3], "#H4");
			Assert.AreSame (descE, descriptors [4], "#H5");
			Assert.AreSame (descF, descriptors [5], "#H6");

			Assert.AreSame (descB, sorted [0], "#I1");
			Assert.AreSame (descD, sorted [1], "#I2");
			Assert.AreSame (descC, sorted [2], "#I3");
			Assert.AreSame (descE, sorted [3], "#I4");
			Assert.AreSame (descA, sorted [4], "#I5");
			Assert.AreSame (descF, sorted [5], "#I6");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:90,代码来源:PropertyDescriptorCollectionTests.cs

示例8: GetProperties

		/// <summary>Retrieves the set of properties for this type. By default, a type does not return any properties. </summary>
		/// <returns>The set of properties that should be exposed for this data type. If no properties should be exposed, this may return null. The default implementation always returns null.</returns>
		/// <param name="context">A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> through which additional context can be provided. </param>
		/// <param name="value">The value of the object to get the properties for. </param>
		/// <param name="attributes">An array of <see cref="T:System.Attribute" /> objects that describe the properties. </param>
		/// <filterpriority>1</filterpriority>
		public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
		{
            Type typeFromHandle = typeof(FloatRectangle);
            PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(new PropertyDescriptor[]
			{
				new FieldPropertyDescriptor(typeFromHandle.GetField("X")),
				new FieldPropertyDescriptor(typeFromHandle.GetField("Y")),
				new FieldPropertyDescriptor(typeFromHandle.GetField("Width")),
				new FieldPropertyDescriptor(typeFromHandle.GetField("Height"))
			});

            propertyDescriptorCollection = propertyDescriptorCollection.Sort(new string[]
			{
				"X",
				"Y",
				"Width",
				"Height",

			});

            return propertyDescriptorCollection;


		}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:30,代码来源:FloatRectangleTypeConverter.cs

示例9: GetEditableProperties

        private PropertyDescriptorCollection GetEditableProperties(object editableObject)
        {
            if (editableObject == null)
                throw new ArgumentNullException("editableObject");

            var webBrowsableFilter = new Attribute[] {WebBrowsableAttribute.Yes};
            var properties = TypeDescriptor.GetProperties(editableObject, webBrowsableFilter);
            var editableProperties = new PropertyDescriptorCollection(null);
            foreach (PropertyDescriptor descriptor in properties)
            {
                if (CanEditProperty(descriptor))
                    editableProperties.Add(descriptor);
            }
            return editableProperties.Sort(new WebCategoryComparer());
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:15,代码来源:PropertyEditorPart.cs


注:本文中的System.ComponentModel.PropertyDescriptorCollection.Sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。