Get constructor from Object - CSharp System

CSharp examples for System:Object

Description

Get constructor from Object

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System;/*w  w  w . j a v a  2 s  .  co  m*/

public class Main{
        public static void creaters(this Object obj)
        {
            if (obj == null) return;

            creaters(obj.GetType());
        }
        public static void creaters(this Type t)
        {
            foreach (ConstructorInfo ci in t.GetConstructors())
            {
                Console.WriteLine("  " + ci);
            }
        }
}

Related Tutorials