Läs på engelska Redigera

Dela via


CodeTypeReference Constructors

Definition

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

Overloads

CodeTypeReference()

Initializes a new instance of the CodeTypeReference class.

CodeTypeReference(CodeTypeParameter)

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

CodeTypeReference(String)

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

CodeTypeReference(Type)

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

CodeTypeReference(CodeTypeReference, Int32)

Initializes a new instance of the CodeTypeReference class using the specified array type and rank.

CodeTypeReference(String, CodeTypeReference[])

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

CodeTypeReference(String, CodeTypeReferenceOptions)

Initializes a new instance of the CodeTypeReference class using the specified type name and code type reference option.

CodeTypeReference(String, Int32)

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

CodeTypeReference(Type, CodeTypeReferenceOptions)

Initializes a new instance of the CodeTypeReference class using the specified type and code type reference.

CodeTypeReference()

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

Initializes a new instance of the CodeTypeReference class.

C#
public CodeTypeReference();

Remarks

This constructor creates an empty CodeTypeReference object. If you use this constructor, set properties to establish the type reference.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(CodeTypeParameter)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

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

C#
public CodeTypeReference(System.CodeDom.CodeTypeParameter typeParameter);

Parameters

typeParameter
CodeTypeParameter

A CodeTypeParameter that represents the type of the type parameter.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(String)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

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

C#
public CodeTypeReference(string? typeName);
C#
public CodeTypeReference(string typeName);

Parameters

typeName
String

The name of the type to reference.

Remarks

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]]]].

Anteckning

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.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(Type)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

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

C#
public CodeTypeReference(Type type);

Parameters

type
Type

The Type to reference.

Exceptions

type is null.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(CodeTypeReference, Int32)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

Initializes a new instance of the CodeTypeReference class using the specified array type and rank.

C#
public CodeTypeReference(System.CodeDom.CodeTypeReference arrayType, int rank);

Parameters

arrayType
CodeTypeReference

A CodeTypeReference that indicates the type of the array.

rank
Int32

The number of dimensions in the array.

Remarks

This constructor can be used to construct arrays of arrays by nesting CodeTypeReference objects.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(String, CodeTypeReference[])

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

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

C#
public CodeTypeReference(string typeName, params System.CodeDom.CodeTypeReference[] typeArguments);

Parameters

typeName
String

The name of the type to reference.

typeArguments
CodeTypeReference[]

An array of CodeTypeReference values.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(String, CodeTypeReferenceOptions)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

Initializes a new instance of the CodeTypeReference class using the specified type name and code type reference option.

C#
public CodeTypeReference(string? typeName, System.CodeDom.CodeTypeReferenceOptions codeTypeReferenceOption);
C#
public CodeTypeReference(string typeName, System.CodeDom.CodeTypeReferenceOptions codeTypeReferenceOption);

Parameters

typeName
String

The name of the type to reference.

codeTypeReferenceOption
CodeTypeReferenceOptions

The code type reference option, one of the CodeTypeReferenceOptions values.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(String, Int32)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

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

C#
public CodeTypeReference(string baseType, int rank);

Parameters

baseType
String

The name of the type of the elements of the array.

rank
Int32

The number of dimensions of the array.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeTypeReference(Type, CodeTypeReferenceOptions)

Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs
Source:
CodeTypeReference.cs

Initializes a new instance of the CodeTypeReference class using the specified type and code type reference.

C#
public CodeTypeReference(Type type, System.CodeDom.CodeTypeReferenceOptions codeTypeReferenceOption);

Parameters

type
Type

The Type to reference.

codeTypeReferenceOption
CodeTypeReferenceOptions

The code type reference option, one of the CodeTypeReferenceOptions values.

Applies to

.NET 10 (package-provided) och andra versioner
Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10