// take type, separate attributes and call methods that return info about public static string AttributesCheck(Type type) { var output = new StringBuilder(); var attributes = type.GetCustomAttributes(false); foreach (var attribute in attributes) { if (attribute is VersionAttribute) { VersionAttribute curentAttribute = attribute as VersionAttribute; output.AppendLine(VersionAttAsString(curentAttribute)); } else if (attribute is AttributeUsageAttribute) { AttributeUsageAttribute curentAttribute = attribute as AttributeUsageAttribute; output.AppendLine(AttUsageAttAsString(curentAttribute)); } } return(output.ToString()); }
// return information for VersionAttribute private static string VersionAttAsString(VersionAttribute curentAttribute) { return(curentAttribute.ToString()); }