public static string GetDisplayName( Type type ) { foreach ( var nameAttribute in type.GetCustomAttributes( typeof( DisplayNameAttribute ), true ) ) { return ( (DisplayNameAttribute)nameAttribute ).DisplayName; } return null; }