private static string GetElementNameFromType(Type type)
{
if (type == null) {
throw new ArgumentNullException("type");
}
ElementNameAttribute elementNameAttribute = (ElementNameAttribute)
Attribute.GetCustomAttribute(type, typeof(ElementNameAttribute),
false);
if (elementNameAttribute != null) {
return elementNameAttribute.Name;
}
return null;
}