I need to pass the AuthorAttribute class as a parameter so I can have a generic class in the code
AuthorAttribute authAttr = attr as AuthorAttribute;
I want to make it dynamic, so I can pass whatever attribute class I need to pull the information out of:
Here is the main code:
public static Dictionary<string, string> GetAuthors(so I need to pass the AuthorAttribute in from here)
{
Dictionary<string, string> _dict = new Dictionary<string, string>();
PropertyInfo[] props = typeof(Book).GetProperties();
foreach (PropertyInfo prop in props)
{
object[] attrs = prop.GetCustomAttributes(true);
foreach (object attr in attrs)
{
AuthorAttribute authAttr = attr as AuthorAttribute;
if (authAttr != null)
{
string propName = prop.Name;
...
Go to the complete details ...