private static string GetDisplayText(object Item)
{
string ObjectName = null;
if (Item == null)
{
return string.Empty;
}
PropertyDescriptor descriptor1 = TypeDescriptor.GetProperties(Item)["Name"];
if (descriptor1 != null)
{
ObjectName = ((string) descriptor1.GetValue(Item));
if (!string.IsNullOrEmpty(ObjectName))
{
return ObjectName;
}
}
if (string.IsNullOrEmpty(ObjectName))
{
ObjectName = Item.GetType().Name;
}
return ObjectName;
}