CodeTypeReference Constructor (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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
Available since 1.1
Return to top