How to pass a type to a method?

c#

Solution

You can use a type name with `typeof`:

f = new DataField("Name", typeof(string));

Problem

How can I call this constructor ? ``` public class DataField { public String Name; public Type TheType; public DataField(string name, Type T) { Name = name; TheType = T; } } ``` I thought of ``` f = new DataField("Name",typeof(new String())); ``` but I want to avoid object creation. So is this one ok ? ``` f = new DataField("Name",String); ```

Original source