المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C# Attributes and methods



C# Programming
10-12-2009, 10:52 PM
Hi all
do you know a way to amutomatic add a method to a class once this last is decorated with a C# custom attribute?
Thanks
MN

// class
[MyAttribute("MyName")]
public class CA
{
public CA()
{}
};
// use of it
CA obj = new CA();
obj.MethodDueToMyAttribute();