Method Attributes : Class Method : Class Interface C# Source Code


Custom Search

C# Source Code » Class Interface » Class Method »

 

Method Attributes








    
 

using System;
using System.Reflection;
public class TransactionableAttribute : Attribute {
    public TransactionableAttribute() {
    }
}

class SomeClass {
    [Transactionable]
    public void Foo() { }

    public void Bar() { }

    [Transactionable]
    public void Goo() { }
}

class Test {
    [STAThread]
    static void Main(string[] args) {
        Type type = Type.GetType("SomeClass");
        foreach (MethodInfo method in type.GetMethods()) {
            foreach (Attribute attr in
                method.GetCustomAttributes(true)) {
                if (attr is TransactionableAttribute) {
                    Console.WriteLine(method.Name);
                }
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Class Interface
» Class Method