GenericTypeParameterBuilder Classe

Definizione

Definisce e crea parametri di tipo generico per i metodi e i tipi generici definiti dinamicamente. La classe non può essere ereditata.

public ref class GenericTypeParameterBuilder sealed : Type
public ref class GenericTypeParameterBuilder sealed : System::Reflection::TypeInfo
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class GenericTypeParameterBuilder : Type
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class GenericTypeParameterBuilder : System.Reflection.TypeInfo
public sealed class GenericTypeParameterBuilder : Type
[<System.Runtime.InteropServices.ComVisible(true)>]
type GenericTypeParameterBuilder = class
    inherit Type
[<System.Runtime.InteropServices.ComVisible(true)>]
type GenericTypeParameterBuilder = class
    inherit TypeInfo
type GenericTypeParameterBuilder = class
    inherit Type
Public NotInheritable Class GenericTypeParameterBuilder
Inherits Type
Public NotInheritable Class GenericTypeParameterBuilder
Inherits TypeInfo
Ereditarietà
GenericTypeParameterBuilder
Ereditarietà
GenericTypeParameterBuilder
Attributi

Esempio

L'esempio di codice seguente crea un tipo generico con due parametri di tipo e li salva nell'assembly GenericEmitExample1.dll. È possibile usare il Ildasm.exe (Disassembler IL) per visualizzare i tipi generati. Per una spiegazione più dettagliata dei passaggi necessari per definire un tipo generico dinamico, vedere Procedura: Definire un tipo generico con Reflection Emit.

using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Collections.Generic;

// Define a trivial base class and two trivial interfaces
// to use when demonstrating constraints.
//
public class ExampleBase {}

public interface IExampleA {}

public interface IExampleB {}

// Define a trivial type that can substitute for type parameter
// TSecond.
//
public class ExampleDerived : ExampleBase, IExampleA, IExampleB {}

public class Example
{
    public static void Main()
    {
        // Define a dynamic assembly to contain the sample type. The
        // assembly will not be run, but only saved to disk, so
        // AssemblyBuilderAccess.Save is specified.
        //
        AppDomain myDomain = AppDomain.CurrentDomain;
        AssemblyName myAsmName = new AssemblyName("GenericEmitExample1");
        AssemblyBuilder myAssembly =
            myDomain.DefineDynamicAssembly(myAsmName,
                AssemblyBuilderAccess.RunAndSave);

        // An assembly is made up of executable modules. For a single-
        // module assembly, the module name and file name are the same
        // as the assembly name.
        //
        ModuleBuilder myModule =
            myAssembly.DefineDynamicModule(myAsmName.Name,
               myAsmName.Name + ".dll");

        // Get type objects for the base class trivial interfaces to
        // be used as constraints.
        //
        Type baseType = typeof(ExampleBase);
        Type interfaceA = typeof(IExampleA);
        Type interfaceB = typeof(IExampleB);

        // Define the sample type.
        //
        TypeBuilder myType =
            myModule.DefineType("Sample", TypeAttributes.Public);

        Console.WriteLine("Type 'Sample' is generic: {0}",
            myType.IsGenericType);

        // Define type parameters for the type. Until you do this,
        // the type is not generic, as the preceding and following
        // WriteLine statements show. The type parameter names are
        // specified as an array of strings. To make the code
        // easier to read, each GenericTypeParameterBuilder is placed
        // in a variable with the same name as the type parameter.
        //
        string[] typeParamNames = {"TFirst", "TSecond"};
        GenericTypeParameterBuilder[] typeParams =
            myType.DefineGenericParameters(typeParamNames);

        GenericTypeParameterBuilder TFirst = typeParams[0];
        GenericTypeParameterBuilder TSecond = typeParams[1];

        Console.WriteLine("Type 'Sample' is generic: {0}",
            myType.IsGenericType);

        // Apply constraints to the type parameters.
        //
        // A type that is substituted for the first parameter, TFirst,
        // must be a reference type and must have a parameterless
        // constructor.
        TFirst.SetGenericParameterAttributes(
            GenericParameterAttributes.DefaultConstructorConstraint |
            GenericParameterAttributes.ReferenceTypeConstraint);

        // A type that is substituted for the second type
        // parameter must implement IExampleA and IExampleB, and
        // inherit from the trivial test class ExampleBase. The
        // interface constraints are specified as an array
        // containing the interface types.
        TSecond.SetBaseTypeConstraint(baseType);
        Type[] interfaceTypes = {interfaceA, interfaceB};
        TSecond.SetInterfaceConstraints(interfaceTypes);

        // The following code adds a private field named ExampleField,
        // of type TFirst.
        FieldBuilder exField =
            myType.DefineField("ExampleField", TFirst,
                FieldAttributes.Private);

        // Define a static method that takes an array of TFirst and
        // returns a List<TFirst> containing all the elements of
        // the array. To define this method it is necessary to create
        // the type List<TFirst> by calling MakeGenericType on the
        // generic type definition, List<T>. (The T is omitted with
        // the typeof operator when you get the generic type
        // definition.) The parameter type is created by using the
        // MakeArrayType method.
        //
        Type listOf = typeof(List<>);
        Type listOfTFirst = listOf.MakeGenericType(TFirst);
        Type[] mParamTypes = {TFirst.MakeArrayType()};

        MethodBuilder exMethod =
            myType.DefineMethod("ExampleMethod",
                MethodAttributes.Public | MethodAttributes.Static,
                listOfTFirst,
                mParamTypes);

        // Emit the method body.
        // The method body consists of just three opcodes, to load
        // the input array onto the execution stack, to call the
        // List<TFirst> constructor that takes IEnumerable<TFirst>,
        // which does all the work of putting the input elements into
        // the list, and to return, leaving the list on the stack. The
        // hard work is getting the constructor.
        //
        // The GetConstructor method is not supported on a
        // GenericTypeParameterBuilder, so it is not possible to get
        // the constructor of List<TFirst> directly. There are two
        // steps, first getting the constructor of List<T> and then
        // calling a method that converts it to the corresponding
        // constructor of List<TFirst>.
        //
        // The constructor needed here is the one that takes an
        // IEnumerable<T>. Note, however, that this is not the
        // generic type definition of IEnumerable<T>; instead, the
        // T from List<T> must be substituted for the T of
        // IEnumerable<T>. (This seems confusing only because both
        // types have type parameters named T. That is why this example
        // uses the somewhat silly names TFirst and TSecond.) To get
        // the type of the constructor argument, take the generic
        // type definition IEnumerable<T> (expressed as
        // IEnumerable<> when you use the typeof operator) and
        // call MakeGenericType with the first generic type parameter
        // of List<T>. The constructor argument list must be passed
        // as an array, with just one argument in this case.
        //
        // Now it is possible to get the constructor of List<T>,
        // using GetConstructor on the generic type definition. To get
        // the constructor of List<TFirst>, pass List<TFirst> and
        // the constructor from List<T> to the static
        // TypeBuilder.GetConstructor method.
        //
        ILGenerator ilgen = exMethod.GetILGenerator();

        Type ienumOf = typeof(IEnumerable<>);
        Type TfromListOf = listOf.GetGenericArguments()[0];
        Type ienumOfT = ienumOf.MakeGenericType(TfromListOf);
        Type[] ctorArgs = {ienumOfT};

        ConstructorInfo ctorPrep = listOf.GetConstructor(ctorArgs);
        ConstructorInfo ctor =
            TypeBuilder.GetConstructor(listOfTFirst, ctorPrep);

        ilgen.Emit(OpCodes.Ldarg_0);
        ilgen.Emit(OpCodes.Newobj, ctor);
        ilgen.Emit(OpCodes.Ret);

        // Create the type and save the assembly.
        Type finished = myType.CreateType();
        myAssembly.Save(myAsmName.Name+".dll");

        // Invoke the method.
        // ExampleMethod is not generic, but the type it belongs to is
        // generic, so in order to get a MethodInfo that can be invoked
        // it is necessary to create a constructed type. The Example
        // class satisfies the constraints on TFirst, because it is a
        // reference type and has a default constructor. In order to
        // have a class that satisfies the constraints on TSecond,
        // this code example defines the ExampleDerived type. These
        // two types are passed to MakeGenericMethod to create the
        // constructed type.
        //
        Type[] typeArgs = {typeof(Example), typeof(ExampleDerived)};
        Type constructed = finished.MakeGenericType(typeArgs);
        MethodInfo mi = constructed.GetMethod("ExampleMethod");

        // Create an array of Example objects, as input to the generic
        // method. This array must be passed as the only element of an
        // array of arguments. The first argument of Invoke is
        // null, because ExampleMethod is static. Display the count
        // on the resulting List<Example>.
        //
        Example[] input = {new Example(), new Example()};
        object[] arguments = {input};

        List<Example> listX =
            (List<Example>) mi.Invoke(null, arguments);

        Console.WriteLine(
            "\nThere are {0} elements in the List<Example>.",
            listX.Count);

        DisplayGenericParameters(finished);
    }

    private static void DisplayGenericParameters(Type t)
    {
        if (!t.IsGenericType)
        {
            Console.WriteLine("Type '{0}' is not generic.");
            return;
        }
        if (!t.IsGenericTypeDefinition)
        {
            t = t.GetGenericTypeDefinition();
        }

        Type[] typeParameters = t.GetGenericArguments();
        Console.WriteLine("\nListing {0} type parameters for type '{1}'.",
            typeParameters.Length, t);

        foreach( Type tParam in typeParameters )
        {
            Console.WriteLine("\r\nType parameter {0}:", tParam.ToString());

            foreach( Type c in tParam.GetGenericParameterConstraints() )
            {
                if (c.IsInterface)
                {
                    Console.WriteLine("    Interface constraint: {0}", c);
                }
                else
                {
                    Console.WriteLine("    Base type constraint: {0}", c);
                }
            }

            ListConstraintAttributes(tParam);
        }
    }

    // List the constraint flags. The GenericParameterAttributes
    // enumeration contains two sets of attributes, variance and
    // constraints. For this example, only constraints are used.
    //
    private static void ListConstraintAttributes(Type t)
    {
        // Mask off the constraint flags.
        GenericParameterAttributes constraints =
            t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask;

        if ((constraints & GenericParameterAttributes.ReferenceTypeConstraint)
            != GenericParameterAttributes.None)
        {
            Console.WriteLine("    ReferenceTypeConstraint");
        }

        if ((constraints & GenericParameterAttributes.NotNullableValueTypeConstraint)
            != GenericParameterAttributes.None)
        {
            Console.WriteLine("    NotNullableValueTypeConstraint");
        }

        if ((constraints & GenericParameterAttributes.DefaultConstructorConstraint)
            !=GenericParameterAttributes.None)
        {
            Console.WriteLine("    DefaultConstructorConstraint");
        }
    }
}

/* This code example produces the following output:

Type 'Sample' is generic: False
Type 'Sample' is generic: True

There are 2 elements in the List<Example>.

Listing 2 type parameters for type 'Sample[TFirst,TSecond]'.

Type parameter TFirst:
    ReferenceTypeConstraint
    DefaultConstructorConstraint

Type parameter TSecond:
    Interface constraint: IExampleA
    Interface constraint: IExampleB
    Base type constraint: ExampleBase
 */
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Collections.Generic

' Define a trivial base class and two trivial interfaces 
' to use when demonstrating constraints.
'
Public Class ExampleBase
End Class

Public Interface IExampleA
End Interface

Public Interface IExampleB
End Interface

' Define a trivial type that can substitute for type parameter 
' TSecond.
'
Public Class ExampleDerived
    Inherits ExampleBase
    Implements IExampleA, IExampleB
End Class

Public Class Example
    Public Shared Sub Main()
        ' Define a dynamic assembly to contain the sample type. The
        ' assembly will not be run, but only saved to disk, so
        ' AssemblyBuilderAccess.Save is specified.
        '
        Dim myDomain As AppDomain = AppDomain.CurrentDomain
        Dim myAsmName As New AssemblyName("GenericEmitExample1")
        Dim myAssembly As AssemblyBuilder = myDomain.DefineDynamicAssembly( _
            myAsmName, _
            AssemblyBuilderAccess.RunAndSave)

        ' An assembly is made up of executable modules. For a single-
        ' module assembly, the module name and file name are the same 
        ' as the assembly name. 
        '
        Dim myModule As ModuleBuilder = myAssembly.DefineDynamicModule( _
            myAsmName.Name, _
            myAsmName.Name & ".dll")

        ' Get type objects for the base class trivial interfaces to
        ' be used as constraints.
        '
        Dim baseType As Type = GetType(ExampleBase)
        Dim interfaceA As Type = GetType(IExampleA)
        Dim interfaceB As Type = GetType(IExampleB)
                
        ' Define the sample type.
        '
        Dim myType As TypeBuilder = myModule.DefineType( _
            "Sample", _
            TypeAttributes.Public)

        Console.WriteLine("Type 'Sample' is generic: {0}", _
            myType.IsGenericType)

        ' Define type parameters for the type. Until you do this, 
        ' the type is not generic, as the preceding and following 
        ' WriteLine statements show. The type parameter names are
        ' specified as an array of strings. To make the code
        ' easier to read, each GenericTypeParameterBuilder is placed
        ' in a variable with the same name as the type parameter.
        ' 
        Dim typeParamNames() As String = {"TFirst", "TSecond"}
        Dim typeParams() As GenericTypeParameterBuilder = _
            myType.DefineGenericParameters(typeParamNames)

        Dim TFirst As GenericTypeParameterBuilder = typeParams(0)
        Dim TSecond As GenericTypeParameterBuilder = typeParams(1)

        Console.WriteLine("Type 'Sample' is generic: {0}", _
            myType.IsGenericType)

        ' Apply constraints to the type parameters.
        '
        ' A type that is substituted for the first parameter, TFirst,
        ' must be a reference type and must have a parameterless
        ' constructor.
        TFirst.SetGenericParameterAttributes( _
            GenericParameterAttributes.DefaultConstructorConstraint _
            Or GenericParameterAttributes.ReferenceTypeConstraint)

        ' A type that is substituted for the second type
        ' parameter must implement IExampleA and IExampleB, and
        ' inherit from the trivial test class ExampleBase. The
        ' interface constraints are specified as an array 
        ' containing the interface types.
        TSecond.SetBaseTypeConstraint(baseType)
        Dim interfaceTypes() As Type = {interfaceA, interfaceB}
        TSecond.SetInterfaceConstraints(interfaceTypes)

        ' The following code adds a private field named ExampleField,
        ' of type TFirst.
        Dim exField As FieldBuilder = _
            myType.DefineField("ExampleField", TFirst, _
                FieldAttributes.Private)

        ' Define a Shared method that takes an array of TFirst and 
        ' returns a List(Of TFirst) containing all the elements of 
        ' the array. To define this method it is necessary to create
        ' the type List(Of TFirst) by calling MakeGenericType on the
        ' generic type definition, List(Of T). (The T is omitted with
        ' the GetType operator when you get the generic type 
        ' definition.) The parameter type is created by using the
        ' MakeArrayType method. 
        '
        Dim listOf As Type = GetType(List(Of ))
        Dim listOfTFirst As Type = listOf.MakeGenericType(TFirst)
        Dim mParamTypes() As Type = { TFirst.MakeArrayType() }

        Dim exMethod As MethodBuilder = _
            myType.DefineMethod("ExampleMethod", _
                MethodAttributes.Public Or MethodAttributes.Static, _
                listOfTFirst, _
                mParamTypes)

        ' Emit the method body. 
        ' The method body consists of just three opcodes, to load 
        ' the input array onto the execution stack, to call the 
        ' List(Of TFirst) constructor that takes IEnumerable(Of TFirst),
        ' which does all the work of putting the input elements into
        ' the list, and to return, leaving the list on the stack. The
        ' hard work is getting the constructor.
        ' 
        ' The GetConstructor method is not supported on a 
        ' GenericTypeParameterBuilder, so it is not possible to get 
        ' the constructor of List(Of TFirst) directly. There are two
        ' steps, first getting the constructor of List(Of T) and then
        ' calling a method that converts it to the corresponding 
        ' constructor of List(Of TFirst).
        '
        ' The constructor needed here is the one that takes an
        ' IEnumerable(Of T). Note, however, that this is not the 
        ' generic type definition of IEnumerable(Of T); instead, the
        ' T from List(Of T) must be substituted for the T of 
        ' IEnumerable(Of T). (This seems confusing only because both
        ' types have type parameters named T. That is why this example
        ' uses the somewhat silly names TFirst and TSecond.) To get
        ' the type of the constructor argument, take the generic
        ' type definition IEnumerable(Of T) (expressed as 
        ' IEnumerable(Of ) when you use the GetType operator) and 
        ' call MakeGenericType with the first generic type parameter
        ' of List(Of T). The constructor argument list must be passed
        ' as an array, with just one argument in this case.
        ' 
        ' Now it is possible to get the constructor of List(Of T),
        ' using GetConstructor on the generic type definition. To get
        ' the constructor of List(Of TFirst), pass List(Of TFirst) and
        ' the constructor from List(Of T) to the static
        ' TypeBuilder.GetConstructor method.
        '
        Dim ilgen As ILGenerator = exMethod.GetILGenerator()
        
        Dim ienumOf As Type = GetType(IEnumerable(Of ))
        Dim listOfTParams() As Type = listOf.GetGenericArguments()
        Dim TfromListOf As Type = listOfTParams(0)
        Dim ienumOfT As Type = ienumOf.MakeGenericType(TfromListOf)
        Dim ctorArgs() As Type = { ienumOfT }

        Dim ctorPrep As ConstructorInfo = _
            listOf.GetConstructor(ctorArgs)
        Dim ctor As ConstructorInfo = _
            TypeBuilder.GetConstructor(listOfTFirst, ctorPrep)

        ilgen.Emit(OpCodes.Ldarg_0)
        ilgen.Emit(OpCodes.Newobj, ctor)
        ilgen.Emit(OpCodes.Ret)

        ' Create the type and save the assembly. 
        Dim finished As Type = myType.CreateType()
        myAssembly.Save(myAsmName.Name & ".dll")

        ' Invoke the method.
        ' ExampleMethod is not generic, but the type it belongs to is
        ' generic, so in order to get a MethodInfo that can be invoked
        ' it is necessary to create a constructed type. The Example 
        ' class satisfies the constraints on TFirst, because it is a 
        ' reference type and has a default constructor. In order to
        ' have a class that satisfies the constraints on TSecond, 
        ' this code example defines the ExampleDerived type. These
        ' two types are passed to MakeGenericMethod to create the
        ' constructed type.
        '
        Dim typeArgs() As Type = _
            { GetType(Example), GetType(ExampleDerived) }
        Dim constructed As Type = finished.MakeGenericType(typeArgs)
        Dim mi As MethodInfo = constructed.GetMethod("ExampleMethod")

        ' Create an array of Example objects, as input to the generic
        ' method. This array must be passed as the only element of an 
        ' array of arguments. The first argument of Invoke is 
        ' Nothing, because ExampleMethod is Shared. Display the count
        ' on the resulting List(Of Example).
        ' 
        Dim input() As Example = { New Example(), New Example() }
        Dim arguments() As Object = { input }

        Dim listX As List(Of Example) = mi.Invoke(Nothing, arguments)

        Console.WriteLine(vbLf & _
            "There are {0} elements in the List(Of Example).", _
            listX.Count _ 
        )

        DisplayGenericParameters(finished)
    End Sub

    Private Shared Sub DisplayGenericParameters(ByVal t As Type)

        If Not t.IsGenericType Then
            Console.WriteLine("Type '{0}' is not generic.")
            Return
        End If
        If Not t.IsGenericTypeDefinition Then _
            t = t.GetGenericTypeDefinition()

        Dim typeParameters() As Type = t.GetGenericArguments()
        Console.WriteLine(vbCrLf & _
            "Listing {0} type parameters for type '{1}'.", _
            typeParameters.Length, t)

        For Each tParam As Type In typeParameters

            Console.WriteLine(vbCrLf & "Type parameter {0}:", _
                tParam.ToString())

            For Each c As Type In tParam.GetGenericParameterConstraints()
                If c.IsInterface Then
                    Console.WriteLine("    Interface constraint: {0}", c)
                Else
                    Console.WriteLine("    Base type constraint: {0}", c)
                End If
            Next 

            ListConstraintAttributes(tParam)
        Next tParam
    End Sub

    ' List the constraint flags. The GenericParameterAttributes
    ' enumeration contains two sets of attributes, variance and
    ' constraints. For this example, only constraints are used.
    '
    Private Shared Sub ListConstraintAttributes(ByVal t As Type)

        ' Mask off the constraint flags. 
        Dim constraints As GenericParameterAttributes = _
            t.GenericParameterAttributes And _
            GenericParameterAttributes.SpecialConstraintMask

        If (constraints And GenericParameterAttributes.ReferenceTypeConstraint) _
                <> GenericParameterAttributes.None Then _
            Console.WriteLine("    ReferenceTypeConstraint")

        If (constraints And GenericParameterAttributes.NotNullableValueTypeConstraint) _
                <> GenericParameterAttributes.None Then _
            Console.WriteLine("    NotNullableValueTypeConstraint")

        If (constraints And GenericParameterAttributes.DefaultConstructorConstraint) _
                <> GenericParameterAttributes.None Then _
            Console.WriteLine("    DefaultConstructorConstraint")

    End Sub 

End Class

' This code example produces the following output:
'
'Type 'Sample' is generic: False
'Type 'Sample' is generic: True
'
'There are 2 elements in the List(Of Example).
'
'Listing 2 type parameters for type 'Sample[TFirst,TSecond]'.
'
'Type parameter TFirst:
'    ReferenceTypeConstraint
'    DefaultConstructorConstraint
'
'Type parameter TSecond:
'    Interface constraint: IExampleA
'    Interface constraint: IExampleB
'    Base type constraint: ExampleBase

Commenti

È possibile ottenere una matrice di GenericTypeParameterBuilder oggetti usando il TypeBuilder.DefineGenericParameters metodo per aggiungere parametri di tipo a un tipo dinamico, rendendolo quindi un tipo generico o usando il MethodBuilder.DefineGenericParameters metodo per aggiungere parametri di tipo a un metodo dinamico. Utilizzare gli GenericTypeParameterBuilder oggetti per aggiungere vincoli ai parametri di tipo. I vincoli sono di tre tipi:

  • Il vincolo del tipo di base specifica che qualsiasi tipo assegnato al parametro di tipo generico deve derivare da un tipo di base specifico. Impostare questo vincolo usando il SetBaseTypeConstraint metodo .

  • Un vincolo di interfaccia specifica che qualsiasi tipo assegnato al parametro di tipo generico deve implementare una particolare interfaccia. Impostare i vincoli di interfaccia usando il SetInterfaceConstraints metodo .

  • I vincoli speciali specificano che qualsiasi tipo assegnato al parametro di tipo generico deve avere un costruttore senza parametri, deve essere un tipo riferimento o deve essere un tipo valore. Impostare i vincoli speciali per un parametro di tipo usando il SetGenericParameterAttributes metodo .

Non è possibile recuperare vincoli di interfaccia e vincoli speciali usando i metodi della GenericTypeParameterBuilder classe . Dopo aver creato il tipo generico che contiene i parametri di tipo, è possibile usare il relativo Type oggetto per riflettere i vincoli. Utilizzare il Type.GetGenericArguments metodo per ottenere i parametri di tipo e per ogni parametro di tipo usare il Type.GetGenericParameterConstraints metodo per ottenere il vincolo di tipo di base e i vincoli di interfaccia e la Type.GenericParameterAttributes proprietà per ottenere i vincoli speciali.

Proprietà

Nome Descrizione
Assembly

Ottiene un Assembly oggetto che rappresenta l'assembly dinamico che contiene la definizione di tipo generico a cui appartiene il parametro di tipo corrente.

AssemblyQualifiedName

Ottiene null in tutti i casi.

Attributes

Ottiene gli attributi associati all'oggetto Type.

(Ereditato da Type)
BaseType

Ottiene il vincolo del tipo di base del parametro di tipo generico corrente.

ContainsGenericParameters

Ottiene true in tutti i casi.

CustomAttributes

Ottiene una raccolta contenente gli attributi personalizzati di questo membro.

(Ereditato da MemberInfo)
DeclaredConstructors

Ottiene una raccolta dei costruttori dichiarati dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredEvents

Ottiene una raccolta degli eventi definiti dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredFields

Ottiene una raccolta dei campi definiti dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredMembers

Ottiene una raccolta dei membri definiti dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredMethods

Ottiene una raccolta dei metodi definiti dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredNestedTypes

Ottiene una raccolta dei tipi annidati definiti dal tipo corrente.

(Ereditato da TypeInfo)
DeclaredProperties

Ottiene una raccolta delle proprietà definite dal tipo corrente.

(Ereditato da TypeInfo)
DeclaringMethod

Ottiene un oggetto MethodInfo che rappresenta il metodo dichiarante, se l'oggetto corrente GenericTypeParameterBuilder rappresenta un parametro di tipo di un metodo generico.

DeclaringType

Ottiene la definizione di tipo generico o la definizione di metodo generico a cui appartiene il parametro di tipo generico.

FullName

Ottiene null in tutti i casi.

GenericParameterAttributes

Ottiene una combinazione di GenericParameterAttributes flag che descrivono la covarianza e i vincoli speciali del parametro di tipo generico corrente.

GenericParameterAttributes

Ottiene una combinazione di GenericParameterAttributes flag che descrivono la covarianza e i vincoli speciali del parametro di tipo generico corrente.

(Ereditato da Type)
GenericParameterPosition

Ottiene la posizione del parametro di tipo nell'elenco dei parametri di tipo del tipo o del metodo generico che ha dichiarato il parametro.

GenericTypeArguments

Ottiene una matrice degli argomenti di tipo generico per questo tipo.

(Ereditato da Type)
GenericTypeParameters

Ottiene una matrice dei parametri di tipo generico dell'istanza corrente.

(Ereditato da TypeInfo)
GUID

Non supportato per i parametri di tipo generico incompleti.

HasElementType

Ottiene un valore che indica se l'oggetto corrente Type comprende o fa riferimento a un altro tipo, ovvero se l'oggetto corrente Type è una matrice, un puntatore o viene passato per riferimento.

(Ereditato da Type)
ImplementedInterfaces

Ottiene una raccolta delle interfacce implementate dal tipo corrente.

(Ereditato da TypeInfo)
IsAbstract

Ottiene un valore che indica se l'oggetto Type è astratto e deve essere sottoposto a override.

(Ereditato da Type)
IsAnsiClass

Ottiene un valore che indica se l'attributo AnsiClass di formato stringa è selezionato per .Type

(Ereditato da Type)
IsArray

Ottiene un valore che indica se il tipo è una matrice.

(Ereditato da Type)
IsAutoClass

Ottiene un valore che indica se l'attributo AutoClass di formato stringa è selezionato per .Type

(Ereditato da Type)
IsAutoLayout

Ottiene un valore che indica se i campi del tipo corrente vengono disposti automaticamente da Common Language Runtime.

(Ereditato da Type)
IsByRef

Ottiene un valore che indica se l'oggetto Type viene passato per riferimento.

(Ereditato da Type)
IsByRefLike

Ottiene un valore che indica se il tipo è una struttura simile a byref.

IsClass

Ottiene un valore che indica se è Type una classe o un delegato, ovvero non un tipo di valore o un'interfaccia.

(Ereditato da Type)
IsCOMObject

Ottiene un valore che indica se è Type un oggetto COM.

(Ereditato da Type)
IsConstructedGenericType

Ottiene un valore che indica se questo oggetto rappresenta un tipo generico costruito.

IsContextful

Ottiene un valore che indica se l'oggetto Type può essere ospitato in un contesto.

(Ereditato da Type)
IsEnum

Ottiene un valore che indica se l'oggetto corrente Type rappresenta un'enumerazione.

(Ereditato da Type)
IsExplicitLayout

Ottiene un valore che indica se i campi del tipo corrente sono disposti in corrispondenza di offset specificati in modo esplicito.

(Ereditato da Type)
IsGenericMethodParameter

Ottiene un valore che indica se l'oggetto corrente Type rappresenta un parametro di tipo nella definizione di un metodo generico.

(Ereditato da Type)
IsGenericParameter

Ottiene true in tutti i casi.

IsGenericType

Restituisce false in tutti i casi.

IsGenericTypeDefinition

Ottiene false in tutti i casi.

IsGenericTypeParameter

Ottiene un valore che indica se l'oggetto corrente Type rappresenta un parametro di tipo nella definizione di un tipo generico.

(Ereditato da Type)
IsImport

Ottiene un valore che indica se l'oggetto Type ha un ComImportAttribute attributo applicato, a indicare che è stato importato da una libreria dei tipi COM.

(Ereditato da Type)
IsInterface

Ottiene un valore che indica se è un'interfaccia Type , ovvero non una classe o un tipo valore.

(Ereditato da Type)
IsLayoutSequential

Ottiene un valore che indica se i campi del tipo corrente sono disposti in sequenza, nell'ordine in cui sono stati definiti o emessi nei metadati.

(Ereditato da Type)
IsMarshalByRef

Ottiene un valore che indica se l'oggetto viene sottoposto a Type marshalling per riferimento.

(Ereditato da Type)
IsNested

Ottiene un valore che indica se l'oggetto corrente Type rappresenta un tipo la cui definizione è annidata all'interno della definizione di un altro tipo.

(Ereditato da Type)
IsNestedAssembly

Ottiene un valore che indica se l'oggetto Type è annidato e visibile solo all'interno del proprio assembly.

(Ereditato da Type)
IsNestedFamANDAssem

Ottiene un valore che indica se l'oggetto Type è annidato e visibile solo alle classi che appartengono sia alla propria famiglia che al relativo assembly.

(Ereditato da Type)
IsNestedFamily

Ottiene un valore che indica se l'oggetto Type è annidato e visibile solo all'interno della propria famiglia.

(Ereditato da Type)
IsNestedFamORAssem

Ottiene un valore che indica se l'oggetto Type è annidato e visibile solo alle classi che appartengono alla propria famiglia o al proprio assembly.

(Ereditato da Type)
IsNestedPrivate

Ottiene un valore che indica se l'oggetto Type è annidato e dichiarato privato.

(Ereditato da Type)
IsNestedPublic

Ottiene un valore che indica se una classe è annidata e dichiarata pubblica.

(Ereditato da Type)
IsNotPublic

Ottiene un valore che indica se l'oggetto Type non è dichiarato pubblico.

(Ereditato da Type)
IsPointer

Ottiene un valore che indica se è Type un puntatore.

(Ereditato da Type)
IsPrimitive

Ottiene un valore che indica se è Type uno dei tipi primitivi.

(Ereditato da Type)
IsPublic

Ottiene un valore che indica se l'oggetto Type è dichiarato pubblico.

(Ereditato da Type)
IsSealed

Ottiene un valore che indica se l'oggetto Type è dichiarato sealed.

(Ereditato da Type)
IsSecurityCritical

Ottiene un valore che indica se il tipo corrente è critico per la sicurezza o critico per la sicurezza a livello di attendibilità corrente e pertanto può eseguire operazioni critiche.

(Ereditato da Type)
IsSecuritySafeCritical

Ottiene un valore che indica se il tipo corrente è critico per la sicurezza a livello di attendibilità corrente; ovvero se può eseguire operazioni critiche e può essere accessibile tramite codice trasparente.

(Ereditato da Type)
IsSecurityTransparent

Ottiene un valore che indica se il tipo corrente è trasparente a livello di trust corrente e pertanto non può eseguire operazioni critiche.

(Ereditato da Type)
IsSerializable

Ottiene un valore che indica se è Type serializzabile binario.

(Ereditato da Type)
IsSignatureType

Ottiene un valore che indica se il tipo è un tipo di firma.

(Ereditato da Type)
IsSpecialName

Ottiene un valore che indica se il tipo ha un nome che richiede una gestione speciale.

(Ereditato da Type)
IsSZArray

Ottiene un valore che indica se il tipo è un tipo di matrice che può rappresentare solo una matrice unidimensionale con un limite inferiore zero.

IsTypeDefinition

Ottiene un valore che indica se il tipo è una definizione di tipo.

IsUnicodeClass

Ottiene un valore che indica se l'attributo UnicodeClass di formato stringa è selezionato per .Type

(Ereditato da Type)
IsValueType

Ottiene un valore che indica se è Type un tipo di valore.

(Ereditato da Type)
IsVariableBoundArray

Definisce e crea parametri di tipo generico per i metodi e i tipi generici definiti dinamicamente. La classe non può essere ereditata.

IsVisible

Ottiene un valore che indica se l'oggetto Type può essere accessibile dal codice all'esterno dell'assembly.

(Ereditato da Type)
MemberType

Ottiene un MemberTypes valore che indica che questo membro è un tipo o un tipo annidato.

(Ereditato da Type)
MetadataToken

Ottiene un valore che identifica un elemento di metadati.

(Ereditato da MemberInfo)
Module

Ottiene il modulo dinamico che contiene il parametro di tipo generico.

Name

Ottiene il nome del parametro di tipo generico.

Namespace

Ottiene null in tutti i casi.

ReflectedType

Ottiene l'oggetto Type utilizzato per ottenere l'oggetto GenericTypeParameterBuilder.

StructLayoutAttribute

Ottiene un oggetto StructLayoutAttribute che descrive il layout del tipo corrente.

(Ereditato da Type)
TypeHandle

Non supportato per i parametri di tipo generico incompleti.

TypeInitializer

Ottiene l'inizializzatore per il tipo.

(Ereditato da Type)
UnderlyingSystemType

Ottiene il parametro di tipo generico corrente.

Metodi

Nome Descrizione
AsType()

Restituisce il tipo corrente come Type oggetto .

(Ereditato da TypeInfo)
Equals(Object)

Verifica se l'oggetto specificato è un'istanza di EventToken ed è uguale all'istanza corrente.

Equals(Type)

Determina se il tipo di sistema sottostante dell'oggetto corrente Type corrisponde al tipo di sistema sottostante dell'oggetto specificato Type.

(Ereditato da Type)
FindInterfaces(TypeFilter, Object)

Restituisce una matrice di Type oggetti che rappresenta un elenco filtrato di interfacce implementate o ereditate dall'oggetto corrente Type.

(Ereditato da Type)
FindMembers(MemberTypes, BindingFlags, MemberFilter, Object)

Restituisce una matrice filtrata di MemberInfo oggetti del tipo di membro specificato.

(Ereditato da Type)
GetArrayRank()

Ottiene il numero di dimensioni in una matrice.

(Ereditato da Type)
GetAttributeFlagsImpl()

Quando sottoposto a override in una classe derivata, implementa la Attributes proprietà e ottiene una combinazione bit per bit di valori di enumerazione che indicano gli attributi associati all'oggetto Type.

(Ereditato da Type)
GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Cerca un costruttore i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

Cerca un costruttore i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, usando i vincoli di associazione specificati.

(Ereditato da Type)
GetConstructor(Type[])

Cerca un costruttore di istanza pubblica i cui parametri corrispondono ai tipi nella matrice specificata.

(Ereditato da Type)
GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

In caso di override in una classe derivata, cerca un costruttore i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetConstructors()

Restituisce tutti i costruttori pubblici definiti per l'oggetto corrente Type.

(Ereditato da Type)
GetConstructors(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetCustomAttributes(Boolean)

Non supportato per i parametri di tipo generico incompleti.

GetCustomAttributes(Type, Boolean)

Non supportato per i parametri di tipo generico incompleti.

GetCustomAttributesData()

Restituisce un elenco di CustomAttributeData oggetti che rappresentano i dati sugli attributi applicati al membro di destinazione.

(Ereditato da MemberInfo)
GetDeclaredEvent(String)

Restituisce un oggetto che rappresenta l'evento specificato dichiarato dal tipo corrente.

(Ereditato da TypeInfo)
GetDeclaredField(String)

Restituisce un oggetto che rappresenta il campo specificato dichiarato dal tipo corrente.

(Ereditato da TypeInfo)
GetDeclaredMethod(String)

Restituisce un oggetto che rappresenta il metodo specificato dichiarato dal tipo corrente.

(Ereditato da TypeInfo)
GetDeclaredMethods(String)

Restituisce un insieme che contiene tutti i metodi dichiarati nel tipo corrente che corrispondono al nome specificato.

(Ereditato da TypeInfo)
GetDeclaredNestedType(String)

Restituisce un oggetto che rappresenta il tipo annidato specificato dichiarato dal tipo corrente.

(Ereditato da TypeInfo)
GetDeclaredProperty(String)

Restituisce un oggetto che rappresenta la proprietà specificata dichiarata dal tipo corrente.

(Ereditato da TypeInfo)
GetDefaultMembers()

Cerca i membri definiti per l'oggetto corrente Type il cui DefaultMemberAttribute oggetto è impostato.

(Ereditato da Type)
GetElementType()

Genera un oggetto NotSupportedException in tutti i casi.

GetEnumName(Object)

Restituisce il nome della costante con il valore specificato per il tipo di enumerazione corrente.

(Ereditato da Type)
GetEnumNames()

Restituisce i nomi dei membri del tipo di enumerazione corrente.

(Ereditato da Type)
GetEnumUnderlyingType()

Restituisce il tipo sottostante del tipo di enumerazione corrente.

(Ereditato da Type)
GetEnumValues()

Restituisce una matrice dei valori delle costanti nel tipo di enumerazione corrente.

(Ereditato da Type)
GetEvent(String, BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetEvent(String)

Restituisce l'oggetto EventInfo che rappresenta l'evento pubblico specificato.

(Ereditato da Type)
GetEvents()

Non supportato per i parametri di tipo generico incompleti.

GetEvents(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetField(String, BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetField(String)

Cerca il campo pubblico con il nome specificato.

(Ereditato da Type)
GetFields()

Restituisce tutti i campi pubblici dell'oggetto corrente Type.

(Ereditato da Type)
GetFields(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetGenericArguments()

Non valido per i parametri di tipo generico.

GetGenericParameterConstraints()

Restituisce una matrice di Type oggetti che rappresentano i vincoli per il parametro di tipo generico corrente.

(Ereditato da Type)
GetGenericTypeDefinition()

Non valido per i parametri di tipo generico.

GetHashCode()

Restituisce un codice hash integer a 32 bit per l'istanza corrente.

GetInterface(String, Boolean)

Non supportato per i parametri di tipo generico incompleti.

GetInterface(String)

Cerca l'interfaccia con il nome specificato.

(Ereditato da Type)
GetInterfaceMap(Type)

Non supportato per i parametri di tipo generico incompleti.

GetInterfaces()

Non supportato per i parametri di tipo generico incompleti.

GetMember(String, BindingFlags)

Cerca i membri specificati utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetMember(String, MemberTypes, BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetMember(String)

Cerca i membri pubblici con il nome specificato.

(Ereditato da Type)
GetMembers()

Restituisce tutti i membri pubblici dell'oggetto corrente Type.

(Ereditato da Type)
GetMembers(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Cerca il metodo specificato i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

Cerca il metodo specificato i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetMethod(String, BindingFlags)

Cerca il metodo specificato utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetMethod(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Cerca il metodo specificato i cui parametri corrispondono al conteggio dei parametri generici, ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetMethod(String, Int32, BindingFlags, Binder, Type[], ParameterModifier[])

Cerca il metodo specificato i cui parametri corrispondono al conteggio dei parametri generici, ai tipi di argomento e ai modificatori specificati, usando i vincoli di associazione specificati.

(Ereditato da Type)
GetMethod(String, Int32, Type[], ParameterModifier[])

Cerca il metodo pubblico specificato i cui parametri corrispondono al conteggio dei parametri generici, ai tipi di argomento e ai modificatori specificati.

(Ereditato da Type)
GetMethod(String, Int32, Type[])

Cerca il metodo pubblico specificato i cui parametri corrispondono al numero di parametri generici e ai tipi di argomento specificati.

(Ereditato da Type)
GetMethod(String, Type[], ParameterModifier[])

Cerca il metodo pubblico specificato i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati.

(Ereditato da Type)
GetMethod(String, Type[])

Cerca il metodo pubblico specificato i cui parametri corrispondono ai tipi di argomento specificati.

(Ereditato da Type)
GetMethod(String)

Cerca il metodo pubblico con il nome specificato.

(Ereditato da Type)
GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Quando sottoposto a override in una classe derivata, cerca il metodo specificato i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetMethodImpl(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

In caso di override in una classe derivata, cerca il metodo specificato i cui parametri corrispondono al conteggio dei parametri generici, ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati e la convenzione di chiamata specificata.

(Ereditato da Type)
GetMethods()

Restituisce tutti i metodi pubblici dell'oggetto corrente Type.

(Ereditato da Type)
GetMethods(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetNestedType(String, BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetNestedType(String)

Cerca il tipo annidato pubblico con il nome specificato.

(Ereditato da Type)
GetNestedTypes()

Restituisce i tipi pubblici annidati nell'oggetto corrente Type.

(Ereditato da Type)
GetNestedTypes(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetProperties()

Restituisce tutte le proprietà pubbliche dell'oggetto corrente Type.

(Ereditato da Type)
GetProperties(BindingFlags)

Non supportato per i parametri di tipo generico incompleti.

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

Cerca la proprietà specificata i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetProperty(String, BindingFlags)

Cerca la proprietà specificata utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetProperty(String, Type, Type[], ParameterModifier[])

Cerca la proprietà pubblica specificata i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati.

(Ereditato da Type)
GetProperty(String, Type, Type[])

Cerca la proprietà pubblica specificata i cui parametri corrispondono ai tipi di argomento specificati.

(Ereditato da Type)
GetProperty(String, Type)

Cerca la proprietà pubblica con il nome e il tipo restituito specificati.

(Ereditato da Type)
GetProperty(String, Type[])

Cerca la proprietà pubblica specificata i cui parametri corrispondono ai tipi di argomento specificati.

(Ereditato da Type)
GetProperty(String)

Cerca la proprietà pubblica con il nome specificato.

(Ereditato da Type)
GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

In caso di override in una classe derivata, cerca la proprietà specificata i cui parametri corrispondono ai tipi di argomento e ai modificatori specificati, utilizzando i vincoli di associazione specificati.

(Ereditato da Type)
GetType()

Ottiene l'oggetto corrente Type.

(Ereditato da Type)
GetTypeCodeImpl()

Restituisce il codice di tipo sottostante di questa Type istanza.

(Ereditato da Type)
HasElementTypeImpl()

Quando sottoposto a override in una classe derivata, implementa la HasElementType proprietà e determina se l'oggetto corrente comprende o fa riferimento a un altro tipo, ovvero se l'oggetto corrente TypeType è una matrice, un puntatore o viene passato per riferimento.

(Ereditato da Type)
HasSameMetadataDefinitionAs(MemberInfo)

Definisce e crea parametri di tipo generico per i metodi e i tipi generici definiti dinamicamente. La classe non può essere ereditata.

(Ereditato da MemberInfo)
InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

Richiama il membro specificato, utilizzando i vincoli di associazione specificati e associando l'elenco di argomenti e le impostazioni cultura specificati.

(Ereditato da Type)
InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

Non supportato per i parametri di tipo generico incompleti.

InvokeMember(String, BindingFlags, Binder, Object, Object[])

Richiama il membro specificato, utilizzando i vincoli di associazione specificati e associando l'elenco di argomenti specificato.

(Ereditato da Type)
IsArrayImpl()

Quando sottoposto a override in una classe derivata, implementa la IsArray proprietà e determina se è Type una matrice.

(Ereditato da Type)
IsAssignableFrom(Type)

Genera un'eccezione NotSupportedException in tutti i casi.

IsAssignableFrom(TypeInfo)

Genera un'eccezione NotSupportedException in tutti i casi.

IsByRefImpl()

Quando sottoposto a override in una classe derivata, implementa la IsByRef proprietà e determina se l'oggetto Type viene passato per riferimento.

(Ereditato da Type)
IsCOMObjectImpl()

Quando sottoposto a override in una classe derivata, implementa la IsCOMObject proprietà e determina se è Type un oggetto COM.

(Ereditato da Type)
IsContextfulImpl()

Implementa la IsContextful proprietà e determina se Type può essere ospitato in un contesto.

(Ereditato da Type)
IsDefined(Type, Boolean)

Non supportato per i parametri di tipo generico incompleti.

IsEnumDefined(Object)

Restituisce un valore che indica se il valore specificato esiste nel tipo di enumerazione corrente.

(Ereditato da Type)
IsEquivalentTo(Type)

Determina se due tipi COM hanno la stessa identità e sono idonei per l'equivalenza del tipo.

(Ereditato da Type)
IsInstanceOfType(Object)

Determina se l'oggetto specificato è un'istanza dell'oggetto corrente Type.

(Ereditato da Type)
IsMarshalByRefImpl()

Implementa la IsMarshalByRef proprietà e determina se l'oggetto Type viene sottoposto a marshalling per riferimento.

(Ereditato da Type)
IsPointerImpl()

Quando sottoposto a override in una classe derivata, implementa la IsPointer proprietà e determina se è Type un puntatore.

(Ereditato da Type)
IsPrimitiveImpl()

Quando sottoposto a override in una classe derivata, implementa la IsPrimitive proprietà e determina se Type è uno dei tipi primitivi.

(Ereditato da Type)
IsSubclassOf(Type)

Non supportato per i parametri di tipo generico incompleti.

IsValueTypeImpl()

Implementa la IsValueType proprietà e determina se Type è un tipo di valore, ovvero non una classe o un'interfaccia.

(Ereditato da Type)
MakeArrayType()

Restituisce il tipo di una matrice unidimensionale il cui tipo di elemento è il parametro di tipo generico.

MakeArrayType(Int32)

Restituisce il tipo di una matrice il cui tipo di elemento è il parametro di tipo generico, con il numero specificato di dimensioni.

MakeByRefType()

Restituisce un Type oggetto che rappresenta il parametro di tipo generico corrente quando viene passato come parametro di riferimento.

MakeGenericType(Type[])

Non valido per i parametri di tipo generico incompleti.

MakePointerType()

Restituisce un Type oggetto che rappresenta un puntatore al parametro di tipo generico corrente.

MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
SetBaseTypeConstraint(Type)

Imposta il tipo di base che un tipo deve ereditare per sostituire il parametro di tipo.

SetCustomAttribute(ConstructorInfo, Byte[])

Imposta un attributo personalizzato usando un BLOB di attributi personalizzato specificato.

SetCustomAttribute(CustomAttributeBuilder)

Impostare un attributo personalizzato usando un generatore di attributi personalizzato.

SetGenericParameterAttributes(GenericParameterAttributes)

Imposta le caratteristiche di varianza e i vincoli speciali del parametro generico, ad esempio il vincolo del costruttore senza parametri.

SetInterfaceConstraints(Type[])

Imposta le interfacce che un tipo deve implementare per sostituire il parametro di tipo.

ToString()

Restituisce una rappresentazione di stringa del parametro di tipo generico corrente.

Implementazioni dell'interfaccia esplicita

Nome Descrizione
_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Esegue il mapping di un set di nomi a un set corrispondente di identificatori dispatch.

(Ereditato da MemberInfo)
_MemberInfo.GetType()

Ottiene un Type oggetto che rappresenta la MemberInfo classe .

(Ereditato da MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto che può quindi essere usato per ottenere informazioni sul tipo relative a un'interfaccia.

(Ereditato da MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

Recupera il numero di interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso alle proprietà e ai metodi esposti da un oggetto .

(Ereditato da MemberInfo)
_Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Esegue il mapping di un set di nomi a un set corrispondente di identificatori dispatch.

(Ereditato da Type)
_Type.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto che può quindi essere usato per ottenere informazioni sul tipo relative a un'interfaccia.

(Ereditato da Type)
_Type.GetTypeInfoCount(UInt32)

Recupera il numero di interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da Type)
_Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso alle proprietà e ai metodi esposti da un oggetto .

(Ereditato da Type)
IReflectableType.GetTypeInfo()

Restituisce una rappresentazione del tipo corrente come TypeInfo oggetto .

(Ereditato da TypeInfo)

Metodi di estensione

Nome Descrizione
GetCustomAttribute(MemberInfo, Type, Boolean)

Recupera un attributo personalizzato di un tipo specificato applicato a un membro specificato e, facoltativamente, controlla i predecessori di tale membro.

GetCustomAttribute(MemberInfo, Type)

Recupera un attributo personalizzato di un tipo specificato applicato a un membro specificato.

GetCustomAttribute<T>(MemberInfo, Boolean)

Recupera un attributo personalizzato di un tipo specificato applicato a un membro specificato e, facoltativamente, controlla i predecessori di tale membro.

GetCustomAttribute<T>(MemberInfo)

Recupera un attributo personalizzato di un tipo specificato applicato a un membro specificato.

GetCustomAttributes(MemberInfo, Boolean)

Recupera una raccolta di attributi personalizzati applicati a un membro specificato e, facoltativamente, controlla i predecessori di tale membro.

GetCustomAttributes(MemberInfo, Type, Boolean)

Recupera una raccolta di attributi personalizzati di un tipo specificato applicato a un membro specificato e, facoltativamente, controlla i predecessori di tale membro.

GetCustomAttributes(MemberInfo, Type)

Recupera una raccolta di attributi personalizzati di un tipo specificato applicato a un membro specificato.

GetCustomAttributes(MemberInfo)

Recupera una raccolta di attributi personalizzati applicati a un membro specificato.

GetCustomAttributes<T>(MemberInfo, Boolean)

Recupera una raccolta di attributi personalizzati di un tipo specificato applicato a un membro specificato e, facoltativamente, controlla i predecessori di tale membro.

GetCustomAttributes<T>(MemberInfo)

Recupera una raccolta di attributi personalizzati di un tipo specificato applicato a un membro specificato.

GetRuntimeEvent(Type, String)

Recupera un oggetto che rappresenta l'evento specificato.

GetRuntimeEvents(Type)

Recupera una raccolta che rappresenta tutti gli eventi definiti in un tipo specificato.

GetRuntimeField(Type, String)

Recupera un oggetto che rappresenta un campo specificato.

GetRuntimeFields(Type)

Recupera un insieme che rappresenta tutti i campi definiti in un tipo specificato.

GetRuntimeInterfaceMap(TypeInfo, Type)

Restituisce un mapping dell'interfaccia per il tipo specificato e l'interfaccia specificata.

GetRuntimeMethod(Type, String, Type[])

Recupera un oggetto che rappresenta un metodo specificato.

GetRuntimeMethods(Type)

Recupera una raccolta che rappresenta tutti i metodi definiti in un tipo specificato.

GetRuntimeProperties(Type)

Recupera una raccolta che rappresenta tutte le proprietà definite in un tipo specificato.

GetRuntimeProperty(Type, String)

Recupera un oggetto che rappresenta una proprietà specificata.

GetTypeInfo(Type)

Restituisce la TypeInfo rappresentazione del tipo specificato.

IsDefined(MemberInfo, Type, Boolean)

Indica se gli attributi personalizzati di un tipo specificato vengono applicati a un membro specificato e, facoltativamente, applicati ai relativi predecessori.

IsDefined(MemberInfo, Type)

Indica se gli attributi personalizzati di un tipo specificato vengono applicati a un membro specificato.

Si applica a

Vedi anche