Giffyguy
Giffyguy

Reputation: 21302

C#.NET: How do I create a new instance of a class based solely on a "Type" object?

Example:

public static System.Object CreateInstance ( System.Type t )
{
    // return t.<CreateNewObject>;
}

Upvotes: 1

Views: 135

Answers (1)

Gabe
Gabe

Reputation: 86808

You want Activator.CreateInstance(t)

Upvotes: 5

Related Questions