Skip to content

Instantly share code, notes, and snippets.

@aloon aloon/gist:5263296
Created Mar 28, 2013

Embed
What would you like to do?
Get the additional info inserted in property through attributtes
using System;
using System.Reflection;
class moreInfoAttribute : Attribute
{
public string valor { get; set; }
}
public class MyClass
{
[moreInfoAttribute(valor = "vale masInfo")]
public bool MyProp { get; set; }
}
class GetInfoAttribute
{
static void Main(string[] args)
{
string e = (typeof(MyClass).GetProperty("MyProp").GetCustomAttribute(typeof(moreInfoAttribute)) as moreInfoAttribute).valor;
Console.WriteLine(e);
}
}
@aloon

This comment has been minimized.

Copy link
Owner Author

commented Mar 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.