CodeTypeReference 构造函数
定义
使用指定的类型初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type.
重载
CodeTypeReference() |
初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class. |
CodeTypeReference(CodeTypeParameter) |
使用指定的代码类型参数初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified code type parameter. |
CodeTypeReference(String) |
使用指定的类型名称初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name. |
CodeTypeReference(Type) |
使用指定的类型初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type. |
CodeTypeReference(CodeTypeReference, Int32) |
使用指定的数组类型和秩初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified array type and rank. |
CodeTypeReference(String, CodeTypeReference[]) |
使用指定的类型名称和类型参数初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name and type arguments. |
CodeTypeReference(String, CodeTypeReferenceOptions) |
使用指定的类型名称和代码类型引用选项初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name and code type reference option. |
CodeTypeReference(String, Int32) |
使用指定的数组类型名称和秩初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified array type name and rank. |
CodeTypeReference(Type, CodeTypeReferenceOptions) |
使用指定的类型和代码类型引用初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type and code type reference. |
CodeTypeReference()
初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class.
public:
CodeTypeReference();
public CodeTypeReference ();
Public Sub New ()
注解
此构造函数创建一个CodeTypeReference空对象。This constructor creates an empty CodeTypeReference object. 如果使用此构造函数, 请设置属性以建立类型引用。If you use this constructor, set properties to establish the type reference.
CodeTypeReference(CodeTypeParameter)
使用指定的代码类型参数初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified code type parameter.
public:
CodeTypeReference(System::CodeDom::CodeTypeParameter ^ typeParameter);
public CodeTypeReference (System.CodeDom.CodeTypeParameter typeParameter);
new System.CodeDom.CodeTypeReference : System.CodeDom.CodeTypeParameter -> System.CodeDom.CodeTypeReference
Public Sub New (typeParameter As CodeTypeParameter)
参数
- typeParameter
- CodeTypeParameter
一个表示类型参数的类型的 CodeTypeParameter。A CodeTypeParameter that represents the type of the type parameter.
CodeTypeReference(String)
使用指定的类型名称初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name.
public:
CodeTypeReference(System::String ^ typeName);
public CodeTypeReference (string typeName);
new System.CodeDom.CodeTypeReference : string -> System.CodeDom.CodeTypeReference
Public Sub New (typeName As String)
参数
- typeName
- String
要引用的类型的名称。The name of the type to reference.
注解
typeName
如果参数引用泛型类型, 则它必须遵循泛型类型的语法约定。If the typeName
parameter references a generic type, it must follow the syntax conventions for generic types. 例如Dictionary<TKey,TValue> , 类型的反射签名, 其中K
是一个字符串V
, 是一个List<T>整数, 由反射表示为以下形式 (删除了程序集信息): System.Collections.Generic.Dictionary`2[[System.String], [System.Collections.Generic.List`1[[System.Int32]]]]
。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]]]]
.
备注
必须使用方括号 ([]) 而不是C#尖括号 (< >) 来分隔泛型参数。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.
CodeTypeReference(Type)
使用指定的类型初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type.
public:
CodeTypeReference(Type ^ type);
public CodeTypeReference (Type type);
new System.CodeDom.CodeTypeReference : Type -> System.CodeDom.CodeTypeReference
参数
异常
type
为 null
。type
is null
.
CodeTypeReference(CodeTypeReference, Int32)
使用指定的数组类型和秩初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified array type and rank.
public:
CodeTypeReference(System::CodeDom::CodeTypeReference ^ arrayType, int rank);
public CodeTypeReference (System.CodeDom.CodeTypeReference arrayType, int rank);
new System.CodeDom.CodeTypeReference : System.CodeDom.CodeTypeReference * int -> System.CodeDom.CodeTypeReference
Public Sub New (arrayType As CodeTypeReference, rank As Integer)
参数
- arrayType
- CodeTypeReference
CodeTypeReference,指示数组的类型。A CodeTypeReference that indicates the type of the array.
- rank
- Int32
数组的维数。The number of dimensions in the array.
注解
此构造函数可用于通过嵌套CodeTypeReference对象来构造数组的数组。This constructor can be used to construct arrays of arrays by nesting CodeTypeReference objects.
CodeTypeReference(String, CodeTypeReference[])
使用指定的类型名称和类型参数初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name and type arguments.
public:
CodeTypeReference(System::String ^ typeName, ... cli::array <System::CodeDom::CodeTypeReference ^> ^ typeArguments);
public CodeTypeReference (string typeName, params System.CodeDom.CodeTypeReference[] typeArguments);
new System.CodeDom.CodeTypeReference : string * System.CodeDom.CodeTypeReference[] -> System.CodeDom.CodeTypeReference
Public Sub New (typeName As String, ParamArray typeArguments As CodeTypeReference())
参数
- typeName
- String
要引用的类型的名称。The name of the type to reference.
- typeArguments
- CodeTypeReference[]
CodeTypeReference 值的数组。An array of CodeTypeReference values.
CodeTypeReference(String, CodeTypeReferenceOptions)
使用指定的类型名称和代码类型引用选项初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type name and code type reference option.
public:
CodeTypeReference(System::String ^ typeName, System::CodeDom::CodeTypeReferenceOptions codeTypeReferenceOption);
public CodeTypeReference (string typeName, System.CodeDom.CodeTypeReferenceOptions codeTypeReferenceOption);
new System.CodeDom.CodeTypeReference : string * System.CodeDom.CodeTypeReferenceOptions -> System.CodeDom.CodeTypeReference
Public Sub New (typeName As String, codeTypeReferenceOption As CodeTypeReferenceOptions)
参数
- typeName
- String
要引用的类型的名称。The name of the type to reference.
- codeTypeReferenceOption
- CodeTypeReferenceOptions
代码类型引用选项,是 CodeTypeReferenceOptions 的值之一。The code type reference option, one of the CodeTypeReferenceOptions values.
CodeTypeReference(String, Int32)
使用指定的数组类型名称和秩初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified array type name and rank.
public:
CodeTypeReference(System::String ^ baseType, int rank);
public CodeTypeReference (string baseType, int rank);
new System.CodeDom.CodeTypeReference : string * int -> System.CodeDom.CodeTypeReference
Public Sub New (baseType As String, rank As Integer)
参数
- baseType
- String
数组元素类型的名称。The name of the type of the elements of the array.
- rank
- Int32
数组的维数。The number of dimensions of the array.
CodeTypeReference(Type, CodeTypeReferenceOptions)
使用指定的类型和代码类型引用初始化 CodeTypeReference 类的新实例。Initializes a new instance of the CodeTypeReference class using the specified type and code type reference.
public:
CodeTypeReference(Type ^ type, System::CodeDom::CodeTypeReferenceOptions codeTypeReferenceOption);
public CodeTypeReference (Type type, System.CodeDom.CodeTypeReferenceOptions codeTypeReferenceOption);
new System.CodeDom.CodeTypeReference : Type * System.CodeDom.CodeTypeReferenceOptions -> System.CodeDom.CodeTypeReference
参数
- codeTypeReferenceOption
- CodeTypeReferenceOptions
代码类型引用选项,是 CodeTypeReferenceOptions 的值之一。The code type reference option, one of the CodeTypeReferenceOptions values.