Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

attributes C# reflection variable update site:stackoverflow.com

private static Dictionary<string, string> GetAuthors()
{
    return typeof(Book).GetProperties()
        .SelectMany(prop => prop.GetCustomAttributes())
        .OfType<AuthorAttribute>()
        .ToDictionary(a => a.GetType().Name.Replace("Attribute", ""), a => a.Name);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #attributes #reflection #variable #update
ADD COMMENT
Topic
Name
6+5 =