B-Arts DocumentationIndice generale

BListCompareProperty - Esempi

Ordinamento per categoria e posizione

using B.BReflections;
using System.Reflection;

List<PropertyInfo> properties = typeof(CustomerEditor)
  .GetProperties()
  .ToList();

properties.Sort(new BListCompareProperty(
  BListCompareProperty.eTypeOrder.Crescente,
  orderByCategory: true));

Con orderByCategory: true, l'ordinamento usa nell'ordine:

  1. CategoryAttribute;

  2. BOrderAttribute.OrderPosition;

  3. nome della proprietà.

Le proprietà senza BOrder ricevono implicitamente posizione int.MaxValue. Con orderByCategory: false viene usato soltanto il nome. Decrescente inverte ciascun confronto.