I\'m building a custom property grid that displays the properties of items in a collection. What I want to do is show only the properties in the grid that are common amongst
Well,
You could create in interface similar to IComparable but instead call it something like IPropertyComparable and then have the classes that implement it use reflection to compare their property names as so...
public int Compare(T x, T y)
{
PropertyInfo[] props = x.GetType().GetProperties();
foreach(PropertyInfo info in props)
{
if(info.name == y.GetType().Name)
....
}
...
I'll let you figure out the rest. It could probably be a little more elegant anyway, use LINQ maybe...