Type.GetConstructors : Type : Reflection C# Source Code


Custom Search

C# Source Code » Reflection » Type »

 

Type.GetConstructors








    
 
using System;
using System.Reflection;

public class Class1 {
    public static int Main() {
        Type t = typeof(MyClass);
        Console.WriteLine("Type of class: " + t);
        Console.WriteLine("Namespace: " + t.Namespace);
        ConstructorInfo[] ci = t.GetConstructors();
        Console.WriteLine("Constructors are:");

        foreach (ConstructorInfo i in ci) {
            Console.WriteLine(i);
        }
        return 0;
    }
    public class MyClass {
        public int pubInteger;
        private int _privValue;

        public MyClass() {
        }

        public MyClass(int IntegerValueIn) {
            pubInteger = IntegerValueIn;
        }

        public int Add10(int IntegerValueIn) {
            Console.WriteLine(IntegerValueIn);
            return IntegerValueIn + 10;
        }

        public int TestProperty {
            get {
                return _privValue;
            }
            set {
                _privValue = value;
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Reflection
» Type