System.CodeDom.CodeTypeReference Class

Represents a reference to a type.

See Also: CodeTypeReference Members

Syntax

[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
public class CodeTypeReference : CodeObject

Remarks

A System.CodeDom.CodeTypeReference object is used to represent a type for CodeDOM objects. When CodeDOM types have a Type property, it is of type System.CodeDom.CodeTypeReference. For example, the CodeMemberField.Type property is a System.CodeDom.CodeTypeReference that represents a field's data type.

A System.CodeDom.CodeTypeReference can be initialized with a Type object or a string. It is generally recommended to use a Type to do this, although it may not always be possible. If initializing an instance of this class with a string, it is strongly recommended to always use fully qualified types, such as "System.Console" instead of just "Console", because not all languages support importing namespaces. Array types can be specified by either passing in a type object for an array or using one of the constructors that accept rank as a parameter.

The CodeTypeReference.BaseType property specifies the name of the type to reference. For references to array types, the CodeTypeReference.ArrayElementType property indicates the type of the elements of the array, and the CodeTypeReference.ArrayRank property indicates the number of dimensions in the array.

Requirements

Namespace: System.CodeDom
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0