Export (0) Print
Expand All

CodeTypeReference Constructor (String)

Initializes a new instance of the CodeTypeReference class using the specified type name.

Namespace:  System.CodeDom
Assembly:  System (in System.dll)

public CodeTypeReference(
	string typeName


Type: System.String

The name of the type to reference.

If the typeName parameter references a generic type, it must follow the syntax conventions for generic types. For example, the reflection signature for a Dictionary<TKey, TValue> type, where K is a string and V is a List<T> of integers, is represented by reflection as the following (with the assembly information removed): System.Collections.Generic.Dictionary`2[[System.String], [System.Collections.Generic.List`1[[System.Int32]]]].


You must use square brackets ([]) and not the C# angle brackets (<>) to delimit generic parameters.

To avoid the possibility of making a mistake in specifying the syntax, consider using the constructor that takes a type as a parameter instead of a string.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft