TypeBuilder Osztály
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Definiálja és létrehozza az osztályok új példányait a futási idő alatt.
public ref class TypeBuilder sealed : Type, System::Runtime::InteropServices::_TypeBuilder
public ref class TypeBuilder sealed : System::Reflection::TypeInfo, System::Runtime::InteropServices::_TypeBuilder
public ref class TypeBuilder sealed : Type
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
public sealed class TypeBuilder : Type, System.Runtime.InteropServices._TypeBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeBuilder : Type, System.Runtime.InteropServices._TypeBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeBuilder : System.Reflection.TypeInfo, System.Runtime.InteropServices._TypeBuilder
public sealed class TypeBuilder : Type
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
type TypeBuilder = class
inherit Type
interface _TypeBuilder
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeBuilder = class
inherit Type
interface _TypeBuilder
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeBuilder = class
inherit TypeInfo
interface _TypeBuilder
type TypeBuilder = class
inherit Type
Public NotInheritable Class TypeBuilder
Inherits Type
Implements _TypeBuilder
Public NotInheritable Class TypeBuilder
Inherits TypeInfo
Implements _TypeBuilder
Public NotInheritable Class TypeBuilder
Inherits Type
- Öröklődés
- Öröklődés
- Attribútumok
- Megvalósítás
Példák
Az alábbi példakód bemutatja, hogyan definiálhat és használhat dinamikus szerelvényt. A példaszerelvény egy típust tartalmaz, MyDynamicTypeamely egy privát mezőt tartalmaz, egy tulajdonságot, amely lekéri és beállítja a magánmezőt, a magánmezőt inicializáló konstruktorokat, valamint egy metódust, amely megszorozza a felhasználó által megadott számot a magánmező értékével, és visszaadja az eredményt.
using System;
using System.Reflection;
using System.Reflection.Emit;
class DemoAssemblyBuilder
{
public static void Main()
{
// This code creates an assembly that contains one type,
// named "MyDynamicType", that has a private field, a property
// that gets and sets the private field, constructors that
// initialize the private field, and a method that multiplies
// a user-supplied number by the private field value and returns
// the result. In C# the type might look like this:
/*
public class MyDynamicType
{
private int m_number;
public MyDynamicType() : this(42) {}
public MyDynamicType(int initNumber)
{
m_number = initNumber;
}
public int Number
{
get { return m_number; }
set { m_number = value; }
}
public int MyMethod(int multiplier)
{
return m_number * multiplier;
}
}
*/
var aName = new AssemblyName("DynamicAssemblyExample");
AssemblyBuilder ab =
AssemblyBuilder.DefineDynamicAssembly(
aName,
AssemblyBuilderAccess.Run);
// The module name is usually the same as the assembly name.
ModuleBuilder mb = ab.DefineDynamicModule(aName.Name ?? "DynamicAssemblyExample");
TypeBuilder tb = mb.DefineType(
"MyDynamicType",
TypeAttributes.Public);
// Add a private field of type int (Int32).
FieldBuilder fbNumber = tb.DefineField(
"m_number",
typeof(int),
FieldAttributes.Private);
// Define a constructor that takes an integer argument and
// stores it in the private field.
Type[] parameterTypes = { typeof(int) };
ConstructorBuilder ctor1 = tb.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
parameterTypes);
ILGenerator ctor1IL = ctor1.GetILGenerator();
// For a constructor, argument zero is a reference to the new
// instance. Push it on the stack before calling the base
// class constructor. Specify the default constructor of the
// base class (System.Object) by passing an empty array of
// types (Type.EmptyTypes) to GetConstructor.
ctor1IL.Emit(OpCodes.Ldarg_0);
ConstructorInfo? ci = typeof(object).GetConstructor(Type.EmptyTypes);
ctor1IL.Emit(OpCodes.Call, ci!);
// Push the instance on the stack before pushing the argument
// that is to be assigned to the private field m_number.
ctor1IL.Emit(OpCodes.Ldarg_0);
ctor1IL.Emit(OpCodes.Ldarg_1);
ctor1IL.Emit(OpCodes.Stfld, fbNumber);
ctor1IL.Emit(OpCodes.Ret);
// Define a default constructor that supplies a default value
// for the private field. For parameter types, pass the empty
// array of types or pass null.
ConstructorBuilder ctor0 = tb.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
Type.EmptyTypes);
ILGenerator ctor0IL = ctor0.GetILGenerator();
// For a constructor, argument zero is a reference to the new
// instance. Push it on the stack before pushing the default
// value on the stack, then call constructor ctor1.
ctor0IL.Emit(OpCodes.Ldarg_0);
ctor0IL.Emit(OpCodes.Ldc_I4_S, 42);
ctor0IL.Emit(OpCodes.Call, ctor1);
ctor0IL.Emit(OpCodes.Ret);
// Define a property named Number that gets and sets the private
// field.
//
// The last argument of DefineProperty is null, because the
// property has no parameters. (If you don't specify null, you must
// specify an array of Type objects. For a parameterless property,
// use the built-in array with no elements: Type.EmptyTypes)
PropertyBuilder pbNumber = tb.DefineProperty(
"Number",
PropertyAttributes.HasDefault,
typeof(int),
null);
// The property "set" and property "get" methods require a special
// set of attributes.
MethodAttributes getSetAttr = MethodAttributes.Public |
MethodAttributes.SpecialName | MethodAttributes.HideBySig;
// Define the "get" accessor method for Number. The method returns
// an integer and has no arguments. (Note that null could be
// used instead of Types.EmptyTypes)
MethodBuilder mbNumberGetAccessor = tb.DefineMethod(
"get_Number",
getSetAttr,
typeof(int),
Type.EmptyTypes);
ILGenerator numberGetIL = mbNumberGetAccessor.GetILGenerator();
// For an instance property, argument zero is the instance. Load the
// instance, then load the private field and return, leaving the
// field value on the stack.
numberGetIL.Emit(OpCodes.Ldarg_0);
numberGetIL.Emit(OpCodes.Ldfld, fbNumber);
numberGetIL.Emit(OpCodes.Ret);
// Define the "set" accessor method for Number, which has no return
// type and takes one argument of type int (Int32).
MethodBuilder mbNumberSetAccessor = tb.DefineMethod(
"set_Number",
getSetAttr,
null,
new Type[] { typeof(int) });
ILGenerator numberSetIL = mbNumberSetAccessor.GetILGenerator();
// Load the instance and then the numeric argument, then store the
// argument in the field.
numberSetIL.Emit(OpCodes.Ldarg_0);
numberSetIL.Emit(OpCodes.Ldarg_1);
numberSetIL.Emit(OpCodes.Stfld, fbNumber);
numberSetIL.Emit(OpCodes.Ret);
// Last, map the "get" and "set" accessor methods to the
// PropertyBuilder. The property is now complete.
pbNumber.SetGetMethod(mbNumberGetAccessor);
pbNumber.SetSetMethod(mbNumberSetAccessor);
// Define a method that accepts an integer argument and returns
// the product of that integer and the private field m_number. This
// time, the array of parameter types is created on the fly.
MethodBuilder meth = tb.DefineMethod(
"MyMethod",
MethodAttributes.Public,
typeof(int),
new Type[] { typeof(int) });
ILGenerator methIL = meth.GetILGenerator();
// To retrieve the private instance field, load the instance it
// belongs to (argument zero). After loading the field, load the
// argument one and then multiply. Return from the method with
// the return value (the product of the two numbers) on the
// execution stack.
methIL.Emit(OpCodes.Ldarg_0);
methIL.Emit(OpCodes.Ldfld, fbNumber);
methIL.Emit(OpCodes.Ldarg_1);
methIL.Emit(OpCodes.Mul);
methIL.Emit(OpCodes.Ret);
// Finish the type.
Type? t = tb.CreateType();
// Because AssemblyBuilderAccess includes Run, the code can be
// executed immediately. Start by getting reflection objects for
// the method and the property.
MethodInfo? mi = t?.GetMethod("MyMethod");
PropertyInfo? pi = t?.GetProperty("Number");
// Create an instance of MyDynamicType using the default
// constructor.
object? o1 = null;
if (t is not null)
o1 = Activator.CreateInstance(t);
// Display the value of the property, then change it to 127 and
// display it again. Use null to indicate that the property
// has no index.
Console.WriteLine("o1.Number: {0}", pi?.GetValue(o1, null));
pi?.SetValue(o1, 127, null);
Console.WriteLine("o1.Number: {0}", pi?.GetValue(o1, null));
// Call MyMethod, passing 22, and display the return value, 22
// times 127. Arguments must be passed as an array, even when
// there is only one.
object[] arguments = { 22 };
Console.WriteLine("o1.MyMethod(22): {0}",
mi?.Invoke(o1, arguments));
// Create an instance of MyDynamicType using the constructor
// that specifies m_Number. The constructor is identified by
// matching the types in the argument array. In this case,
// the argument array is created on the fly. Display the
// property value.
object? o2 = null;
if (t is not null)
o2 = Activator.CreateInstance(t, new object[] { 5280 });
Console.WriteLine("o2.Number: {0}", pi?.GetValue(o2, null));
}
}
/* This code produces the following output:
o1.Number: 42
o1.Number: 127
o1.MyMethod(22): 2794
o2.Number: 5280
*/
Imports System.Reflection
Imports System.Reflection.Emit
Class DemoAssemblyBuilder
Public Shared Sub Main()
' This code creates an assembly that contains one type,
' named "MyDynamicType", that has a private field, a property
' that gets and sets the private field, constructors that
' initialize the private field, and a method that multiplies
' a user-supplied number by the private field value and returns
' the result. The code might look like this in Visual Basic:
'
'Public Class MyDynamicType
' Private m_number As Integer
'
' Public Sub New()
' Me.New(42)
' End Sub
'
' Public Sub New(ByVal initNumber As Integer)
' m_number = initNumber
' End Sub
'
' Public Property Number As Integer
' Get
' Return m_number
' End Get
' Set
' m_Number = Value
' End Set
' End Property
'
' Public Function MyMethod(ByVal multiplier As Integer) As Integer
' Return m_Number * multiplier
' End Function
'End Class
Dim aName As New AssemblyName("DynamicAssemblyExample")
Dim ab As AssemblyBuilder = _
AssemblyBuilder.DefineDynamicAssembly( _
aName, _
AssemblyBuilderAccess.Run)
' The module name is usually the same as the assembly name.
Dim mb As ModuleBuilder = ab.DefineDynamicModule( _
aName.Name)
Dim tb As TypeBuilder = _
mb.DefineType("MyDynamicType", TypeAttributes.Public)
' Add a private field of type Integer (Int32).
Dim fbNumber As FieldBuilder = tb.DefineField( _
"m_number", _
GetType(Integer), _
FieldAttributes.Private)
' Define a constructor that takes an integer argument and
' stores it in the private field.
Dim parameterTypes() As Type = { GetType(Integer) }
Dim ctor1 As ConstructorBuilder = _
tb.DefineConstructor( _
MethodAttributes.Public, _
CallingConventions.Standard, _
parameterTypes)
Dim ctor1IL As ILGenerator = ctor1.GetILGenerator()
' For a constructor, argument zero is a reference to the new
' instance. Push it on the stack before calling the base
' class constructor. Specify the default constructor of the
' base class (System.Object) by passing an empty array of
' types (Type.EmptyTypes) to GetConstructor.
ctor1IL.Emit(OpCodes.Ldarg_0)
ctor1IL.Emit(OpCodes.Call, _
GetType(Object).GetConstructor(Type.EmptyTypes))
' Push the instance on the stack before pushing the argument
' that is to be assigned to the private field m_number.
ctor1IL.Emit(OpCodes.Ldarg_0)
ctor1IL.Emit(OpCodes.Ldarg_1)
ctor1IL.Emit(OpCodes.Stfld, fbNumber)
ctor1IL.Emit(OpCodes.Ret)
' Define a default constructor that supplies a default value
' for the private field. For parameter types, pass the empty
' array of types or pass Nothing.
Dim ctor0 As ConstructorBuilder = tb.DefineConstructor( _
MethodAttributes.Public, _
CallingConventions.Standard, _
Type.EmptyTypes)
Dim ctor0IL As ILGenerator = ctor0.GetILGenerator()
' For a constructor, argument zero is a reference to the new
' instance. Push it on the stack before pushing the default
' value on the stack, then call constructor ctor1.
ctor0IL.Emit(OpCodes.Ldarg_0)
ctor0IL.Emit(OpCodes.Ldc_I4_S, 42)
ctor0IL.Emit(OpCodes.Call, ctor1)
ctor0IL.Emit(OpCodes.Ret)
' Define a property named Number that gets and sets the private
' field.
'
' The last argument of DefineProperty is Nothing, because the
' property has no parameters. (If you don't specify Nothing, you must
' specify an array of Type objects. For a parameterless property,
' use the built-in array with no elements: Type.EmptyTypes)
Dim pbNumber As PropertyBuilder = tb.DefineProperty( _
"Number", _
PropertyAttributes.HasDefault, _
GetType(Integer), _
Nothing)
' The property Set and property Get methods require a special
' set of attributes.
Dim getSetAttr As MethodAttributes = _
MethodAttributes.Public Or MethodAttributes.SpecialName _
Or MethodAttributes.HideBySig
' Define the "get" accessor method for Number. The method returns
' an integer and has no arguments. (Note that Nothing could be
' used instead of Types.EmptyTypes)
Dim mbNumberGetAccessor As MethodBuilder = tb.DefineMethod( _
"get_Number", _
getSetAttr, _
GetType(Integer), _
Type.EmptyTypes)
Dim numberGetIL As ILGenerator = mbNumberGetAccessor.GetILGenerator()
' For an instance property, argument zero is the instance. Load the
' instance, then load the private field and return, leaving the
' field value on the stack.
numberGetIL.Emit(OpCodes.Ldarg_0)
numberGetIL.Emit(OpCodes.Ldfld, fbNumber)
numberGetIL.Emit(OpCodes.Ret)
' Define the "set" accessor method for Number, which has no return
' type and takes one argument of type Integer (Int32).
Dim mbNumberSetAccessor As MethodBuilder = _
tb.DefineMethod( _
"set_Number", _
getSetAttr, _
Nothing, _
New Type() { GetType(Integer) })
Dim numberSetIL As ILGenerator = mbNumberSetAccessor.GetILGenerator()
' Load the instance and then the numeric argument, then store the
' argument in the field.
numberSetIL.Emit(OpCodes.Ldarg_0)
numberSetIL.Emit(OpCodes.Ldarg_1)
numberSetIL.Emit(OpCodes.Stfld, fbNumber)
numberSetIL.Emit(OpCodes.Ret)
' Last, map the "get" and "set" accessor methods to the
' PropertyBuilder. The property is now complete.
pbNumber.SetGetMethod(mbNumberGetAccessor)
pbNumber.SetSetMethod(mbNumberSetAccessor)
' Define a method that accepts an integer argument and returns
' the product of that integer and the private field m_number. This
' time, the array of parameter types is created on the fly.
Dim meth As MethodBuilder = tb.DefineMethod( _
"MyMethod", _
MethodAttributes.Public, _
GetType(Integer), _
New Type() { GetType(Integer) })
Dim methIL As ILGenerator = meth.GetILGenerator()
' To retrieve the private instance field, load the instance it
' belongs to (argument zero). After loading the field, load the
' argument one and then multiply. Return from the method with
' the return value (the product of the two numbers) on the
' execution stack.
methIL.Emit(OpCodes.Ldarg_0)
methIL.Emit(OpCodes.Ldfld, fbNumber)
methIL.Emit(OpCodes.Ldarg_1)
methIL.Emit(OpCodes.Mul)
methIL.Emit(OpCodes.Ret)
' Finish the type.
Dim t As Type = tb.CreateType()
' Because AssemblyBuilderAccess includes Run, the code can be
' executed immediately. Start by getting reflection objects for
' the method and the property.
Dim mi As MethodInfo = t.GetMethod("MyMethod")
Dim pi As PropertyInfo = t.GetProperty("Number")
' Create an instance of MyDynamicType using the default
' constructor.
Dim o1 As Object = Activator.CreateInstance(t)
' Display the value of the property, then change it to 127 and
' display it again. Use Nothing to indicate that the property
' has no index.
Console.WriteLine("o1.Number: {0}", pi.GetValue(o1, Nothing))
pi.SetValue(o1, 127, Nothing)
Console.WriteLine("o1.Number: {0}", pi.GetValue(o1, Nothing))
' Call MyMethod, passing 22, and display the return value, 22
' times 127. Arguments must be passed as an array, even when
' there is only one.
Dim arguments() As Object = { 22 }
Console.WriteLine("o1.MyMethod(22): {0}", _
mi.Invoke(o1, arguments))
' Create an instance of MyDynamicType using the constructor
' that specifies m_Number. The constructor is identified by
' matching the types in the argument array. In this case,
' the argument array is created on the fly. Display the
' property value.
Dim o2 As Object = Activator.CreateInstance(t, _
New Object() { 5280 })
Console.WriteLine("o2.Number: {0}", pi.GetValue(o2, Nothing))
End Sub
End Class
' This code produces the following output:
'
'o1.Number: 42
'o1.Number: 127
'o1.MyMethod(22): 2794
'o2.Number: 5280
Az alábbi kódminta bemutatja, hogyan hozhat létre dinamikusan egy típust a használatával TypeBuilder.
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
class TestILGenerator
{
public static Type DynamicDotProductGen()
{
Type ivType = null;
Type[] ctorParams = new Type[] { typeof(int),
typeof(int),
typeof(int)};
AppDomain myDomain = Thread.GetDomain();
AssemblyName myAsmName = new AssemblyName();
myAsmName.Name = "IntVectorAsm";
AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(
myAsmName,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder IntVectorModule = myAsmBuilder.DefineDynamicModule("IntVectorModule",
"Vector.dll");
TypeBuilder ivTypeBld = IntVectorModule.DefineType("IntVector",
TypeAttributes.Public);
FieldBuilder xField = ivTypeBld.DefineField("x", typeof(int),
FieldAttributes.Private);
FieldBuilder yField = ivTypeBld.DefineField("y", typeof(int),
FieldAttributes.Private);
FieldBuilder zField = ivTypeBld.DefineField("z", typeof(int),
FieldAttributes.Private);
Type objType = Type.GetType("System.Object");
ConstructorInfo objCtor = objType.GetConstructor(new Type[0]);
ConstructorBuilder ivCtor = ivTypeBld.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
ctorParams);
ILGenerator ctorIL = ivCtor.GetILGenerator();
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Call, objCtor);
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_1);
ctorIL.Emit(OpCodes.Stfld, xField);
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_2);
ctorIL.Emit(OpCodes.Stfld, yField);
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_3);
ctorIL.Emit(OpCodes.Stfld, zField);
ctorIL.Emit(OpCodes.Ret);
// This method will find the dot product of the stored vector
// with another.
Type[] dpParams = new Type[] { ivTypeBld };
// Here, you create a MethodBuilder containing the
// name, the attributes (public, static, private, and so on),
// the return type (int, in this case), and a array of Type
// indicating the type of each parameter. Since the sole parameter
// is a IntVector, the very class you're creating, you will
// pass in the TypeBuilder (which is derived from Type) instead of
// a Type object for IntVector, avoiding an exception.
// -- This method would be declared in C# as:
// public int DotProduct(IntVector aVector)
MethodBuilder dotProductMthd = ivTypeBld.DefineMethod(
"DotProduct",
MethodAttributes.Public,
typeof(int),
dpParams);
// A ILGenerator can now be spawned, attached to the MethodBuilder.
ILGenerator mthdIL = dotProductMthd.GetILGenerator();
// Here's the body of our function, in MSIL form. We're going to find the
// "dot product" of the current vector instance with the passed vector
// instance. For reference purposes, the equation is:
// (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product
// First, you'll load the reference to the current instance "this"
// stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent
// instruction, will pop the reference off the stack and look up the
// field "x", specified by the FieldInfo token "xField".
mthdIL.Emit(OpCodes.Ldarg_0);
mthdIL.Emit(OpCodes.Ldfld, xField);
// That completed, the value stored at field "x" is now atop the stack.
// Now, you'll do the same for the object reference we passed as a
// parameter, stored in argument 1 (ldarg.1). After Ldfld executed,
// you'll have the value stored in field "x" for the passed instance
// atop the stack.
mthdIL.Emit(OpCodes.Ldarg_1);
mthdIL.Emit(OpCodes.Ldfld, xField);
// There will now be two values atop the stack - the "x" value for the
// current vector instance, and the "x" value for the passed instance.
// You'll now multiply them, and push the result onto the evaluation stack.
mthdIL.Emit(OpCodes.Mul_Ovf_Un);
// Now, repeat this for the "y" fields of both vectors.
mthdIL.Emit(OpCodes.Ldarg_0);
mthdIL.Emit(OpCodes.Ldfld, yField);
mthdIL.Emit(OpCodes.Ldarg_1);
mthdIL.Emit(OpCodes.Ldfld, yField);
mthdIL.Emit(OpCodes.Mul_Ovf_Un);
// At this time, the results of both multiplications should be atop
// the stack. You'll now add them and push the result onto the stack.
mthdIL.Emit(OpCodes.Add_Ovf_Un);
// Multiply both "z" field and push the result onto the stack.
mthdIL.Emit(OpCodes.Ldarg_0);
mthdIL.Emit(OpCodes.Ldfld, zField);
mthdIL.Emit(OpCodes.Ldarg_1);
mthdIL.Emit(OpCodes.Ldfld, zField);
mthdIL.Emit(OpCodes.Mul_Ovf_Un);
// Finally, add the result of multiplying the "z" fields with the
// result of the earlier addition, and push the result - the dot product -
// onto the stack.
mthdIL.Emit(OpCodes.Add_Ovf_Un);
// The "ret" opcode will pop the last value from the stack and return it
// to the calling method. You're all done!
mthdIL.Emit(OpCodes.Ret);
ivType = ivTypeBld.CreateType();
return ivType;
}
public static void Main() {
Type IVType = null;
object aVector1 = null;
object aVector2 = null;
Type[] aVtypes = new Type[] {typeof(int), typeof(int), typeof(int)};
object[] aVargs1 = new object[] {10, 10, 10};
object[] aVargs2 = new object[] {20, 20, 20};
// Call the method to build our dynamic class.
IVType = DynamicDotProductGen();
Console.WriteLine("---");
ConstructorInfo myDTctor = IVType.GetConstructor(aVtypes);
aVector1 = myDTctor.Invoke(aVargs1);
aVector2 = myDTctor.Invoke(aVargs2);
object[] passMe = new object[1];
passMe[0] = (object)aVector2;
Console.WriteLine("(10, 10, 10) . (20, 20, 20) = {0}",
IVType.InvokeMember("DotProduct",
BindingFlags.InvokeMethod,
null,
aVector1,
passMe));
// +++ OUTPUT +++
// ---
// (10, 10, 10) . (20, 20, 20) = 600
}
}
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit
_
Class TestILGenerator
Public Shared Function DynamicDotProductGen() As Type
Dim ivType As Type = Nothing
Dim ctorParams() As Type = {GetType(Integer), GetType(Integer), GetType(Integer)}
Dim myDomain As AppDomain = Thread.GetDomain()
Dim myAsmName As New AssemblyName()
myAsmName.Name = "IntVectorAsm"
Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly( _
myAsmName, _
AssemblyBuilderAccess.RunAndSave)
Dim IntVectorModule As ModuleBuilder = myAsmBuilder.DefineDynamicModule( _
"IntVectorModule", _
"Vector.dll")
Dim ivTypeBld As TypeBuilder = IntVectorModule.DefineType("IntVector", TypeAttributes.Public)
Dim xField As FieldBuilder = ivTypeBld.DefineField("x", _
GetType(Integer), _
FieldAttributes.Private)
Dim yField As FieldBuilder = ivTypeBld.DefineField("y", _
GetType(Integer), _
FieldAttributes.Private)
Dim zField As FieldBuilder = ivTypeBld.DefineField("z", _
GetType(Integer), _
FieldAttributes.Private)
Dim objType As Type = Type.GetType("System.Object")
Dim objCtor As ConstructorInfo = objType.GetConstructor(New Type() {})
Dim ivCtor As ConstructorBuilder = ivTypeBld.DefineConstructor( _
MethodAttributes.Public, _
CallingConventions.Standard, _
ctorParams)
Dim ctorIL As ILGenerator = ivCtor.GetILGenerator()
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Call, objCtor)
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_1)
ctorIL.Emit(OpCodes.Stfld, xField)
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_2)
ctorIL.Emit(OpCodes.Stfld, yField)
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_3)
ctorIL.Emit(OpCodes.Stfld, zField)
ctorIL.Emit(OpCodes.Ret)
' Now, you'll construct the method find the dot product of two vectors. First,
' let's define the parameters that will be accepted by the method. In this case,
' it's an IntVector itself!
Dim dpParams() As Type = {ivTypeBld}
' Here, you create a MethodBuilder containing the
' name, the attributes (public, static, private, and so on),
' the return type (int, in this case), and a array of Type
' indicating the type of each parameter. Since the sole parameter
' is a IntVector, the very class you're creating, you will
' pass in the TypeBuilder (which is derived from Type) instead of
' a Type object for IntVector, avoiding an exception.
' -- This method would be declared in VB.NET as:
' Public Function DotProduct(IntVector aVector) As Integer
Dim dotProductMthd As MethodBuilder = ivTypeBld.DefineMethod("DotProduct", _
MethodAttributes.Public, GetType(Integer), _
dpParams)
' A ILGenerator can now be spawned, attached to the MethodBuilder.
Dim mthdIL As ILGenerator = dotProductMthd.GetILGenerator()
' Here's the body of our function, in MSIL form. We're going to find the
' "dot product" of the current vector instance with the passed vector
' instance. For reference purposes, the equation is:
' (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product
' First, you'll load the reference to the current instance "this"
' stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent
' instruction, will pop the reference off the stack and look up the
' field "x", specified by the FieldInfo token "xField".
mthdIL.Emit(OpCodes.Ldarg_0)
mthdIL.Emit(OpCodes.Ldfld, xField)
' That completed, the value stored at field "x" is now atop the stack.
' Now, you'll do the same for the object reference we passed as a
' parameter, stored in argument 1 (ldarg.1). After Ldfld executed,
' you'll have the value stored in field "x" for the passed instance
' atop the stack.
mthdIL.Emit(OpCodes.Ldarg_1)
mthdIL.Emit(OpCodes.Ldfld, xField)
' There will now be two values atop the stack - the "x" value for the
' current vector instance, and the "x" value for the passed instance.
' You'll now multiply them, and push the result onto the evaluation stack.
mthdIL.Emit(OpCodes.Mul_Ovf_Un)
' Now, repeat this for the "y" fields of both vectors.
mthdIL.Emit(OpCodes.Ldarg_0)
mthdIL.Emit(OpCodes.Ldfld, yField)
mthdIL.Emit(OpCodes.Ldarg_1)
mthdIL.Emit(OpCodes.Ldfld, yField)
mthdIL.Emit(OpCodes.Mul_Ovf_Un)
' At this time, the results of both multiplications should be atop
' the stack. You'll now add them and push the result onto the stack.
mthdIL.Emit(OpCodes.Add_Ovf_Un)
' Multiply both "z" field and push the result onto the stack.
mthdIL.Emit(OpCodes.Ldarg_0)
mthdIL.Emit(OpCodes.Ldfld, zField)
mthdIL.Emit(OpCodes.Ldarg_1)
mthdIL.Emit(OpCodes.Ldfld, zField)
mthdIL.Emit(OpCodes.Mul_Ovf_Un)
' Finally, add the result of multiplying the "z" fields with the
' result of the earlier addition, and push the result - the dot product -
' onto the stack.
mthdIL.Emit(OpCodes.Add_Ovf_Un)
' The "ret" opcode will pop the last value from the stack and return it
' to the calling method. You're all done!
mthdIL.Emit(OpCodes.Ret)
ivType = ivTypeBld.CreateType()
Return ivType
End Function 'DynamicDotProductGen
Public Shared Sub Main()
Dim IVType As Type = Nothing
Dim aVector1 As Object = Nothing
Dim aVector2 As Object = Nothing
Dim aVtypes() As Type = {GetType(Integer), GetType(Integer), GetType(Integer)}
Dim aVargs1() As Object = {10, 10, 10}
Dim aVargs2() As Object = {20, 20, 20}
' Call the method to build our dynamic class.
IVType = DynamicDotProductGen()
Dim myDTctor As ConstructorInfo = IVType.GetConstructor(aVtypes)
aVector1 = myDTctor.Invoke(aVargs1)
aVector2 = myDTctor.Invoke(aVargs2)
Console.WriteLine("---")
Dim passMe(0) As Object
passMe(0) = CType(aVector2, Object)
Console.WriteLine("(10, 10, 10) . (20, 20, 20) = {0}", _
IVType.InvokeMember("DotProduct", BindingFlags.InvokeMethod, _
Nothing, aVector1, passMe))
End Sub
End Class
' +++ OUTPUT +++
' ---
' (10, 10, 10) . (20, 20, 20) = 600
Megjegyzések
Az API-val kapcsolatos további információkért lásd a TypeBuilder kiegészítő API-megjegyzéseit.
Mezők
| Name | Description |
|---|---|
| UnspecifiedTypeSize |
Azt jelzi, hogy a típus teljes mérete nincs megadva. |
Tulajdonságok
| Name | Description |
|---|---|
| Assembly |
Lekéri az ezt a típusdefiníciót tartalmazó dinamikus szerelvényt. |
| AssemblyQualifiedName |
Ennek a típusnak a teljes nevét adja vissza a szerelvény megjelenítendő nevével. |
| Attributes |
Lekéri a .Type (Öröklődés forrása Type) |
| BaseType |
Lekéri ennek a típusnak az alaptípusát. |
| ContainsGenericParameters |
Egy értéket kap, amely jelzi, hogy az aktuális Type objektum rendelkezik-e olyan típusparaméterekkel, amelyeket nem cseréltek le adott típusok. (Öröklődés forrása Type) |
| CustomAttributes |
Lekéri a tag egyéni attribútumait tartalmazó gyűjteményt. (Öröklődés forrása MemberInfo) |
| DeclaredConstructors |
Lekéri az aktuális típus által deklarált konstruktorok gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredEvents |
Lekéri az aktuális típus által definiált események gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredFields |
Lekéri az aktuális típus által definiált mezők gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredMembers |
Lekéri az aktuális típus által definiált tagok gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredMethods |
Lekéri az aktuális típus által definiált metódusok gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredNestedTypes |
Lekéri az aktuális típus által definiált beágyazott típusok gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaredProperties |
Lekéri az aktuális típus által definiált tulajdonságok gyűjteményét. (Öröklődés forrása TypeInfo) |
| DeclaringMethod |
Lekéri az aktuális általános típusparamétert deklarált metódust. |
| DeclaringType |
Azt a típust adja vissza, amely deklarálta ezt a típust. |
| FullName |
A típus teljes elérési útját kéri le. |
| GenericParameterAttributes |
Olyan értéket kap, amely az aktuális általános típusparaméter kovarianciáját és különleges korlátait jelzi. |
| GenericParameterPosition |
Lekéri a típusparaméter pozícióját a paramétert deklaráló általános típus típusparaméter-listájában. |
| GenericTypeArguments |
Lekéri az ehhez a típushoz tartozó általános típusú argumentumokat tartalmazó tömböt. (Öröklődés forrása Type) |
| GenericTypeParameters |
Lekéri az aktuális példány általános típusparamétereinek tömbét. (Öröklődés forrása TypeInfo) |
| GUID |
Lekéri az ilyen típusú GUID azonosítót. |
| HasElementType |
Egy értéket kap, amely azt jelzi, hogy az áram Type egy másik típusra terjed-e ki vagy hivatkozik-e; vagyis azt, hogy az áram Type tömb, mutató vagy hivatkozás útján van-e átadva. (Öröklődés forrása Type) |
| ImplementedInterfaces |
Lekéri az aktuális típus által implementált interfészek gyűjteményét. (Öröklődés forrása TypeInfo) |
| IsAbstract |
Egy értéket kap, amely jelzi, hogy az Type absztrakt-e, és felül kell-e bírálni. (Öröklődés forrása Type) |
| IsAnsiClass |
Beolvas egy értéket, amely jelzi, hogy a sztringformátum attribútum |
| IsArray |
Olyan értéket kap, amely jelzi, hogy a típus tömb-e. (Öröklődés forrása Type) |
| IsAutoClass |
Beolvas egy értéket, amely jelzi, hogy a sztringformátum attribútum |
| IsAutoLayout |
Egy értéket kap, amely jelzi, hogy az aktuális típusú mezőket a közös nyelvi futtatókörnyezet automatikusan lefekteti-e. (Öröklődés forrása Type) |
| IsByRef |
Lekéri az értéket, amely jelzi, hogy az Type átadás hivatkozással történik-e. (Öröklődés forrása Type) |
| IsByRefLike |
Olyan értéket kap, amely jelzi, hogy a típus byref-szerű struktúra-e. |
| IsClass |
Olyan értéket kap, amely azt jelzi, hogy az Type osztály vagy meghatalmazott; vagyis nem értéktípus vagy interfész. (Öröklődés forrása Type) |
| IsCOMObject |
Beolvas egy értéket, amely jelzi, hogy a Type com-objektum-e. (Öröklődés forrása Type) |
| IsConstructedGenericType |
Olyan értéket kap, amely jelzi, hogy ez az objektum egy létrehozott általános típust jelöl-e. |
| IsContextful |
Beolvas egy értéket, amely jelzi, hogy a Type rendszer üzemeltethető-e egy környezetben. (Öröklődés forrása Type) |
| IsEnum |
Beolvas egy értéket, amely jelzi, hogy az aktuális Type számbavételt jelent-e. (Öröklődés forrása Type) |
| IsExplicitLayout |
Beolvas egy értéket, amely jelzi, hogy az aktuális típusú mezők explicit módon megadott eltolásokon vannak-e elhelyezve. (Öröklődés forrása Type) |
| IsGenericMethodParameter |
Olyan értéket kap, amely jelzi, hogy az aktuális Type érték egy típusparamétert jelöl-e egy általános metódus definíciójában. (Öröklődés forrása Type) |
| IsGenericParameter |
Beolvas egy értéket, amely jelzi, hogy az aktuális típus általános típusparaméter-e. |
| IsGenericType |
Beolvas egy értéket, amely jelzi, hogy az aktuális típus általános típus-e. |
| IsGenericTypeDefinition |
Beolvas egy értéket, amely jelzi, hogy az aktuális TypeBuilder érték egy általános típusdefiníciót jelöl-e, amelyből más általános típusok is létrehozhatók. |
| IsGenericTypeParameter |
Olyan értéket kap, amely jelzi, hogy az aktuális Type érték egy típusparamétert jelöl-e egy általános típus definíciójában. (Öröklődés forrása Type) |
| IsImport |
Beolvas egy értéket, amely jelzi, hogy az Type attribútum alkalmazva van-e ComImportAttribute , ami azt jelzi, hogy egy COM-típustárból importálták. (Öröklődés forrása Type) |
| IsInterface |
Olyan értéket kap, amely azt jelzi, hogy az Type interfész, vagyis nem osztály vagy értéktípus. (Öröklődés forrása Type) |
| IsLayoutSequential |
Lekéri az értéket, amely jelzi, hogy az aktuális típusú mezők egymás után vannak-e elrendezve a metaadatok definiálásának vagy kiadásának sorrendjében. (Öröklődés forrása Type) |
| IsMarshalByRef |
Lekéri az értéket, amely jelzi, hogy hivatkozással Type van-e megadva. (Öröklődés forrása Type) |
| IsNested |
Beolvas egy értéket, amely jelzi, hogy az aktuális Type objektum egy olyan típust jelöl-e, amelynek definíciója egy másik típus definíciója közé van ágyazva. (Öröklődés forrása Type) |
| IsNestedAssembly |
Egy értéket kap, amely jelzi, hogy a Type rendszer beágyazva van-e, és csak a saját szerelvényén belül látható-e. (Öröklődés forrása Type) |
| IsNestedFamANDAssem |
Egy értéket kap, amely jelzi, hogy a rendszer csak a Type saját családjához és saját szerelvényéhez tartozó osztályokba ágyazott és látható-e. (Öröklődés forrása Type) |
| IsNestedFamily |
Egy értéket kap, amely jelzi, hogy a Type beágyazott és csak a saját családján belül látható-e. (Öröklődés forrása Type) |
| IsNestedFamORAssem |
Egy értéket kap, amely jelzi, hogy a Type beágyazott és csak a saját családjához vagy saját szerelvényéhez tartozó osztályokban van-e beágyazott és látható. (Öröklődés forrása Type) |
| IsNestedPrivate |
Beolvas egy értéket, amely jelzi, hogy a Type beágyazott és a deklarált privát. (Öröklődés forrása Type) |
| IsNestedPublic |
Beolvas egy értéket, amely jelzi, hogy egy osztály beágyazva van-e és nyilvánosan deklarálva van-e. (Öröklődés forrása Type) |
| IsNotPublic |
Egy értéket kap, amely jelzi, hogy a Type nem nyilvános deklarált érték van-e deklarálva. (Öröklődés forrása Type) |
| IsPointer |
Egy értéket kap, amely jelzi, hogy az Type mutató-e. (Öröklődés forrása Type) |
| IsPrimitive |
Egy értéket kap, amely jelzi, hogy az Type egyik primitív típus-e. (Öröklődés forrása Type) |
| IsPublic |
Lekéri a nyilvános deklarált értéket Type . (Öröklődés forrása Type) |
| IsSealed |
Egy értéket kap, amely jelzi, hogy a Type deklarált lezárt-e. (Öröklődés forrása Type) |
| IsSecurityCritical |
Olyan értéket kap, amely jelzi, hogy az aktuális típus biztonsági szempontból kritikus vagy biztonságos-kritikus, ezért kritikus műveleteket hajthat végre. |
| IsSecuritySafeCritical |
Olyan értéket kap, amely azt jelzi, hogy az aktuális típus biztonsági szempontból biztonságos-kritikus; vagyis hogy képes-e kritikus műveleteket végrehajtani, és transzparens kóddal elérhető-e. |
| IsSecurityTransparent |
Olyan értéket kap, amely jelzi, hogy az aktuális típus transzparens-e, ezért nem hajthat végre kritikus műveleteket. |
| IsSerializable |
Egy értéket kap, amely jelzi, hogy a Type bináris szerializálható-e. (Öröklődés forrása Type) |
| IsSignatureType |
Olyan értéket kap, amely jelzi, hogy a típus aláírástípus-e. (Öröklődés forrása Type) |
| IsSpecialName |
Egy értéket kap, amely jelzi, hogy a típus rendelkezik-e különleges kezelést igénylő névvel. (Öröklődés forrása Type) |
| IsSZArray |
Definiálja és létrehozza az osztályok új példányait a futási idő alatt. |
| IsTypeDefinition |
Definiálja és létrehozza az osztályok új példányait a futási idő alatt. |
| IsUnicodeClass |
Beolvas egy értéket, amely jelzi, hogy a sztringformátum attribútum |
| IsValueType |
Lekéri az értéket, amely jelzi, hogy az Type értéktípus-e. (Öröklődés forrása Type) |
| IsVariableBoundArray |
Definiálja és létrehozza az osztályok új példányait a futási idő alatt. |
| IsVisible |
Beolvas egy értéket, amely jelzi, hogy a Type szerelvényen kívüli kóddal elérhető-e. (Öröklődés forrása Type) |
| MemberType |
Beolvas egy MemberTypes értéket, amely azt jelzi, hogy ez a tag típus vagy beágyazott típus. (Öröklődés forrása Type) |
| MetadataToken |
Egy metaadat-elemet azonosító értéket kap. (Öröklődés forrása MemberInfo) |
| Module |
Lekéri a típusdefiníciót tartalmazó dinamikus modult. |
| Name |
Lekéri ennek a típusnak a nevét. |
| Namespace |
Lekéri azt a névteret, ahol ez |
| PackingSize |
Lekéri az ilyen típusú csomagolás méretét. |
| ReflectedType |
A típus beszerzéséhez használt típust adja vissza. |
| Size |
Egy típus teljes méretét kéri le. |
| StructLayoutAttribute |
StructLayoutAttribute Lekéri az aktuális típus elrendezését leíró parancsot. (Öröklődés forrása Type) |
| TypeHandle |
A dinamikus modulok nem támogatottak. |
| TypeInitializer |
Lekéri a típushoz tartozó inicializálót. (Öröklődés forrása Type) |
| TypeToken |
Ennek a típusnak a típusjogkivonatát adja vissza. |
| UnderlyingSystemType |
Ennek a rendszernek a mögöttes rendszertípusát |
Metódusok
| Name | Description |
|---|---|
| AddDeclarativeSecurity(SecurityAction, PermissionSet) |
Deklaratív biztonságot ad ehhez a típushoz. |
| AddInterfaceImplementation(Type) |
Hozzáad egy felületet, amelyet ez a típus implementál. |
| AsType() |
Az aktuális típust adja vissza objektumként Type . (Öröklődés forrása TypeInfo) |
| CreateType() |
Létrehoz egy Type objektumot az osztály számára. Az osztály |
| CreateTypeInfo() |
TypeInfo Lekéri az ilyen típusú objektumokat. |
| DefineConstructor(MethodAttributes, CallingConventions, Type[], Type[][], Type[][]) |
Új konstruktort ad hozzá a típushoz a megadott attribútumokkal, aláírással és egyéni módosítókkal. |
| DefineConstructor(MethodAttributes, CallingConventions, Type[]) |
Új konstruktort ad hozzá a típushoz a megadott attribútumokkal és aláírással. |
| DefineDefaultConstructor(MethodAttributes) |
Meghatározza a paraméter nélküli konstruktort. Az itt definiált konstruktor egyszerűen meghívja a szülő paraméter nélküli konstruktorát. |
| DefineEvent(String, EventAttributes, Type) |
Új eseményt ad hozzá a típushoz a megadott névvel, attribútumokkal és eseménytípussal. |
| DefineField(String, Type, FieldAttributes) |
Új mezőt ad hozzá a típushoz a megadott névvel, attribútumokkal és mezőtípussal. |
| DefineField(String, Type, Type[], Type[], FieldAttributes) |
Új mezőt ad hozzá a típushoz a megadott névvel, attribútumokkal, mezőtípussal és egyéni módosítókkal. |
| DefineGenericParameters(String[]) |
Meghatározza az aktuális típus általános típusparamétereit, megadja a számukat és a nevüket, és egy objektumtömböt GenericTypeParameterBuilder ad vissza, amely a kényszerek beállításához használható. |
| DefineInitializedData(String, Byte[], FieldAttributes) |
Inicializált adatmezőt határoz meg a hordozható végrehajtható (PE) fájl .sdata szakaszában. |
| DefineMethod(String, MethodAttributes, CallingConventions, Type, Type[], Type[], Type[], Type[][], Type[][]) |
Új metódust ad hozzá a típushoz a megadott névvel, metódusattribútumokkal, hívási konvencióval, metódusaírással és egyéni módosítókkal. |
| DefineMethod(String, MethodAttributes, CallingConventions, Type, Type[]) |
Új metódust ad hozzá a típushoz a megadott névvel, metódusattribútumokkal, hívási konvencióval és metódusaírással. |
| DefineMethod(String, MethodAttributes, CallingConventions) |
Új metódust ad hozzá a típushoz a megadott névvel, metódusattribútumokkal és hívási konvencióval. |
| DefineMethod(String, MethodAttributes, Type, Type[]) |
Új metódust ad hozzá a típushoz a megadott névvel, metódusattribútumokkal és metódus-aláírással. |
| DefineMethod(String, MethodAttributes) |
Új metódust ad hozzá a típushoz a megadott névvel és metódusattribútumokkal. |
| DefineMethodOverride(MethodInfo, MethodInfo) |
Egy adott metódustörzset határoz meg, amely egy adott metódusdeklarációt implementál, esetleg más néven. |
| DefineNestedType(String, TypeAttributes, Type, Int32) |
Beágyazott típust határoz meg a nevével, attribútumaival, a típus teljes méretével és a kiterjesztett típussal. |
| DefineNestedType(String, TypeAttributes, Type, PackingSize, Int32) |
Beágyazott típust határoz meg a nevével, attribútumaival, méretével és kiterjesztett típusával. |
| DefineNestedType(String, TypeAttributes, Type, PackingSize) |
Beágyazott típust határoz meg a nevével, attribútumaival, a kiterjesztett típussal és a csomagolás méretével. |
| DefineNestedType(String, TypeAttributes, Type, Type[]) |
Beágyazott típust határoz meg a nevével, attribútumaival, a kiterjesztett típussal és az általa implementált felületekkel. |
| DefineNestedType(String, TypeAttributes, Type) |
Beágyazott típust határoz meg a nevével, attribútumaival és az általa kiterjesztett típussal. |
| DefineNestedType(String, TypeAttributes) |
Beágyazott típust határoz meg a nevével és attribútumaival. |
| DefineNestedType(String) |
Beágyazott típust határoz meg a nevével. |
| DefinePInvokeMethod(String, String, MethodAttributes, CallingConventions, Type, Type[], CallingConvention, CharSet) |
Definiál egy metódust |
| DefinePInvokeMethod(String, String, String, MethodAttributes, CallingConventions, Type, Type[], CallingConvention, CharSet) |
Definiál egy metódust |
| DefinePInvokeMethod(String, String, String, MethodAttributes, CallingConventions, Type, Type[], Type[], Type[], Type[][], Type[][], CallingConvention, CharSet) |
Definiál egy metódust |
| DefineProperty(String, PropertyAttributes, CallingConventions, Type, Type[], Type[], Type[], Type[][], Type[][]) |
Új tulajdonságot ad hozzá a típushoz a megadott névvel, a hívási konvencióval, a tulajdonság aláírásával és az egyéni módosítókkal. |
| DefineProperty(String, PropertyAttributes, CallingConventions, Type, Type[]) |
Új tulajdonságot ad hozzá a típushoz a megadott névvel, attribútumokkal, hívási konvencióval és tulajdonságadékkal. |
| DefineProperty(String, PropertyAttributes, Type, Type[], Type[], Type[], Type[][], Type[][]) |
Új tulajdonságot ad hozzá a típushoz a megadott névvel, a tulajdonság aláírásával és az egyéni módosítókkal. |
| DefineProperty(String, PropertyAttributes, Type, Type[]) |
Új tulajdonságot ad hozzá a típushoz a megadott névvel és a tulajdonság aláírásával. |
| DefineTypeInitializer() |
Meghatározza az inicializálót ehhez a típushoz. |
| DefineUninitializedData(String, Int32, FieldAttributes) |
Meghatároz egy nem inicializált adatmezőt a |
| Equals(Object) |
Meghatározza, hogy az aktuális Type objektum mögöttes rendszertípusa megegyezik-e a megadott Objectrendszertípussal. (Öröklődés forrása Type) |
| Equals(Type) |
Meghatározza, hogy az áram Type mögöttes rendszertípusa megegyezik-e a megadott Typerendszertípussal. (Öröklődés forrása Type) |
| FindInterfaces(TypeFilter, Object) |
Egy objektumtömböt Type ad vissza, amely az aktuális Typeáltal implementált vagy örökölt interfészek szűrt listáját jelöli. (Öröklődés forrása Type) |
| FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) |
A megadott tagtípusú objektumok szűrt tömbjének MemberInfo visszaadása. (Öröklődés forrása Type) |
| GetArrayRank() |
A tömbben lévő dimenziók számát adja meg. (Öröklődés forrása Type) |
| GetAttributeFlagsImpl() |
Ha egy származtatott osztályban felül van bírálva, implementálja a Attributes tulajdonságot, és bitenkénti számbavételi értékeket kap, amelyek a .Type (Öröklődés forrása Type) |
| GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Olyan konstruktort keres, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések és a megadott hívási konvenciók használatával. (Öröklődés forrása Type) |
| GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[]) |
Olyan konstruktort keres, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések használatával. (Öröklődés forrása Type) |
| GetConstructor(Type, ConstructorInfo) |
A megadott konstruktort adja vissza, amely megfelel az általános típusdefiníció megadott konstruktorának. |
| GetConstructor(Type[]) |
Olyan nyilvános példánykonstruktort keres, amelynek paraméterei megegyeznek a megadott tömb típusával. (Öröklődés forrása Type) |
| GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Ha egy származtatott osztályban felül van bírálva, olyan konstruktort keres, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések és a megadott hívási konvenciók használatával. (Öröklődés forrása Type) |
| GetConstructors() |
Az aktuálishoz Typedefiniált összes nyilvános konstruktort adja vissza. (Öröklődés forrása Type) |
| GetConstructors(BindingFlags) |
Az osztályhoz definiált nyilvános és nem nyilvános konstruktorokat képviselő objektumtömböt ConstructorInfo ad vissza a megadott módon. |
| GetCustomAttributes(Boolean) |
Az ehhez a típushoz definiált összes egyéni attribútumot adja vissza. |
| GetCustomAttributes(Type, Boolean) |
Az aktuális típus összes olyan egyéni attribútumát adja vissza, amely hozzárendelhető egy adott típushoz. |
| GetCustomAttributesData() |
Visszaadja a CustomAttributeData céltagra alkalmazott attribútumok adatait képviselő objektumok listáját. (Öröklődés forrása MemberInfo) |
| GetDeclaredEvent(String) |
Egy objektumot ad vissza, amely az aktuális típus által deklarált megadott eseményt jelöli. (Öröklődés forrása TypeInfo) |
| GetDeclaredField(String) |
Egy objektumot ad vissza, amely az aktuális típus által deklarált megadott mezőt jelöli. (Öröklődés forrása TypeInfo) |
| GetDeclaredMethod(String) |
Az aktuális típus által deklarált megadott metódust képviselő objektumot ad vissza. (Öröklődés forrása TypeInfo) |
| GetDeclaredMethods(String) |
Olyan gyűjteményt ad vissza, amely az aktuális típuson deklarált összes metódust tartalmazza, amely megfelel a megadott névnek. (Öröklődés forrása TypeInfo) |
| GetDeclaredNestedType(String) |
Az aktuális típus által deklarált beágyazott típust képviselő objektumot ad vissza. (Öröklődés forrása TypeInfo) |
| GetDeclaredProperty(String) |
Egy objektumot ad vissza, amely az aktuális típus által deklarált megadott tulajdonságot jelöli. (Öröklődés forrása TypeInfo) |
| GetDefaultMembers() |
Megkeresi az aktuálishoz Type definiált tagokat, akiknek DefaultMemberAttribute a beállítása be van állítva. (Öröklődés forrása Type) |
| GetElementType() |
Ennek a metódusnak a meghívása NotSupportedExceptionmindig dob. |
| GetEnumName(Object) |
A megadott értékkel bíró állandó nevét adja vissza az aktuális számbavételi típushoz. (Öröklődés forrása Type) |
| GetEnumNames() |
Az aktuális számbavételi típus tagjainak nevét adja vissza. (Öröklődés forrása Type) |
| GetEnumUnderlyingType() |
Az aktuális enumerálási típus alapjául szolgáló típust adja vissza. (Öröklődés forrása Type) |
| GetEnumValues() |
Az aktuális számbavételi típus állandóinak értékeinek tömbje. (Öröklődés forrása Type) |
| GetEvent(String, BindingFlags) |
A megadott névvel rendelkező eseményt adja vissza. |
| GetEvent(String) |
EventInfo A megadott nyilvános eseményt képviselő objektumot adja vissza. (Öröklődés forrása Type) |
| GetEvents() |
Az ilyen típus által deklarált vagy örökölt nyilvános eseményeket adja vissza. |
| GetEvents(BindingFlags) |
Az ilyen típusú deklarált nyilvános és nem nyilvános eseményeket adja vissza. |
| GetField(String, BindingFlags) |
A megadott név által megadott mezőt adja vissza. |
| GetField(String) |
Megkeresi a megadott névvel rendelkező nyilvános mezőt. (Öröklődés forrása Type) |
| GetField(Type, FieldInfo) |
A megadott konstruktált általános típus azon mezőjét adja vissza, amely megfelel az általános típusdefiníció megadott mezőjének. |
| GetFields() |
Az aktuális Typenyilvános mezőket adja vissza. (Öröklődés forrása Type) |
| GetFields(BindingFlags) |
Az ilyen típusú deklarált nyilvános és nem nyilvános mezőket adja vissza. |
| GetGenericArguments() |
Egy általános típus típusargumentumait vagy egy általános típusdefiníció típusparamétereit képviselő objektumtömböt Type ad vissza. |
| GetGenericParameterConstraints() |
Olyan objektumtömböt Type ad vissza, amely az aktuális általános típusparaméter korlátait képviseli. (Öröklődés forrása Type) |
| GetGenericTypeDefinition() |
Olyan Type objektumot ad vissza, amely egy általános típusdefiníciót jelöl, amelyből az aktuális típus lekérhető. |
| GetHashCode() |
A példány kivonatkódját adja vissza. (Öröklődés forrása Type) |
| GetInterface(String, Boolean) |
Az osztály által (közvetlenül vagy közvetve) megvalósított felületet adja vissza a megadott felületnévnek megfelelő teljes névvel. |
| GetInterface(String) |
Megkeresi a megadott névvel rendelkező felületet. (Öröklődés forrása Type) |
| GetInterfaceMap(Type) |
A kért felület felületleképezését adja vissza. |
| GetInterfaces() |
Egy tömböt ad vissza az ezen a típuson implementált összes interfészből és annak alaptípusaiból. |
| GetMember(String, BindingFlags) |
A megadott kötési korlátozások használatával megkeresi a megadott tagokat. (Öröklődés forrása Type) |
| GetMember(String, MemberTypes, BindingFlags) |
A megadott módon visszaadja az ilyen típusú deklarált vagy öröklődő összes nyilvános és nem nyilvános tagot. |
| GetMember(String) |
Megkeresi a megadott névvel rendelkező nyilvános tagokat. (Öröklődés forrása Type) |
| GetMembers() |
Az aktuális Typenyilvános tagok összes nyilvános tagját adja vissza. (Öröklődés forrása Type) |
| GetMembers(BindingFlags) |
Az ilyen típusú deklarált vagy öröklődő nyilvános és nem nyilvános tagok tagjait adja vissza. |
| GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Megkeresi azt a megadott metódust, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések és a megadott hívási konvenciók használatával. (Öröklődés forrása Type) |
| GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) |
Megkeresi azt a megadott metódust, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések használatával. (Öröklődés forrása Type) |
| GetMethod(String, BindingFlags) |
Megkeresi a megadott metódust a megadott kötési megkötések használatával. (Öröklődés forrása Type) |
| GetMethod(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Megkeresi azt a megadott metódust, amelynek paraméterei megfelelnek a megadott általános paraméterszámnak, argumentumtípusoknak és módosítóknak a megadott kötési megkötések és a megadott hívási konvenciók használatával. (Öröklődés forrása Type) |
| GetMethod(String, Int32, BindingFlags, Binder, Type[], ParameterModifier[]) |
Megkeresi azt a megadott metódust, amelynek paraméterei megfelelnek a megadott általános paraméterszámnak, argumentumtípusoknak és módosítóknak a megadott kötési megkötések használatával. (Öröklődés forrása Type) |
| GetMethod(String, Int32, Type[], ParameterModifier[]) |
Megkeresi a megadott nyilvános metódust, amelynek paraméterei megfelelnek a megadott általános paraméterszámnak, argumentumtípusoknak és módosítóknak. (Öröklődés forrása Type) |
| GetMethod(String, Int32, Type[]) |
Megkeresi a megadott nyilvános metódust, amelynek paraméterei megfelelnek a megadott általános paraméterszámnak és argumentumtípusoknak. (Öröklődés forrása Type) |
| GetMethod(String, Type[], ParameterModifier[]) |
Megkeresi a megadott nyilvános metódust, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak. (Öröklődés forrása Type) |
| GetMethod(String, Type[]) |
Megkeresi a megadott nyilvános metódust, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak. (Öröklődés forrása Type) |
| GetMethod(String) |
A megadott névvel rendelkező nyilvános metódust keresi. (Öröklődés forrása Type) |
| GetMethod(Type, MethodInfo) |
A megadott konstruktált általános típus metódusát adja vissza, amely megfelel az általános típusdefiníció megadott metódusának. |
| GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Ha egy származtatott osztályban felül van bírálva, megkeresi azt a metódust, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak, a megadott kötési megkötések és a megadott hívási konvenció használatával. (Öröklődés forrása Type) |
| GetMethodImpl(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
Ha egy származtatott osztályban felül van bírálva, megkeresi azt a metódust, amelynek paraméterei megfelelnek a megadott általános paraméterszámnak, argumentumtípusoknak és módosítóknak a megadott kötési megkötések és a megadott hívási konvenció használatával. (Öröklődés forrása Type) |
| GetMethods() |
Az aktuális Typenyilvános metódusokat adja vissza. (Öröklődés forrása Type) |
| GetMethods(BindingFlags) |
A megadott módon visszaadja az ilyen típusú deklarált vagy örökölt összes nyilvános és nem nyilvános metódust. |
| GetNestedType(String, BindingFlags) |
Az ilyen típus által deklarált nyilvános és nem nyilvános beágyazott típusokat adja vissza. |
| GetNestedType(String) |
Megkeresi a megadott névvel rendelkező nyilvános beágyazott típust. (Öröklődés forrása Type) |
| GetNestedTypes() |
Az aktuálisban Typebeágyazott nyilvános típusokat adja vissza. (Öröklődés forrása Type) |
| GetNestedTypes(BindingFlags) |
Azokat a nyilvános és nem nyilvános beágyazott típusokat adja vissza, amelyeket ez a típus deklarál vagy örököl. |
| GetProperties() |
Az aktuális Typenyilvános tulajdonságokat adja eredményül. (Öröklődés forrása Type) |
| GetProperties(BindingFlags) |
A megadott módon visszaadja az ilyen típusú deklarált vagy öröklődő összes nyilvános és nem nyilvános tulajdonságot. |
| GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) |
Megkeresi a megadott tulajdonságot, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak a megadott kötési megkötések használatával. (Öröklődés forrása Type) |
| GetProperty(String, BindingFlags) |
Megkeresi a megadott tulajdonságot a megadott kötési korlátozások használatával. (Öröklődés forrása Type) |
| GetProperty(String, Type, Type[], ParameterModifier[]) |
Megkeresi a megadott nyilvános tulajdonságot, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak. (Öröklődés forrása Type) |
| GetProperty(String, Type, Type[]) |
Megkeresi a megadott nyilvános tulajdonságot, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak. (Öröklődés forrása Type) |
| GetProperty(String, Type) |
Megkeresi a megadott névvel és visszatérési típussal rendelkező nyilvános tulajdonságot. (Öröklődés forrása Type) |
| GetProperty(String, Type[]) |
Megkeresi a megadott nyilvános tulajdonságot, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak. (Öröklődés forrása Type) |
| GetProperty(String) |
Megkeresi a megadott nevű nyilvános tulajdonságot. (Öröklődés forrása Type) |
| GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) |
Ha egy származtatott osztályban felül van bírálva, a megadott kötési korlátozások használatával megkeresi azt a tulajdonságot, amelynek paraméterei megfelelnek a megadott argumentumtípusoknak és módosítóknak. (Öröklődés forrása Type) |
| GetType() |
Lekéri az aktuálisat Type. (Öröklődés forrása Type) |
| GetTypeCodeImpl() |
A példány mögöttes típuskódját Type adja vissza. (Öröklődés forrása Type) |
| HasElementTypeImpl() |
Ha egy származtatott osztályban felül van bírálva, implementálja a HasElementType tulajdonságot, és meghatározza, hogy az áram Type egy másik típusra terjed-e ki vagy hivatkozik-e; vagyis hogy az aktuális Type tömb, mutató vagy hivatkozás alapján van-e átadva. (Öröklődés forrása Type) |
| HasSameMetadataDefinitionAs(MemberInfo) |
Definiálja és létrehozza az osztályok új példányait a futási idő alatt. (Öröklődés forrása MemberInfo) |
| InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) |
Meghívja a megadott tagot a megadott kötési korlátozások használatával, és megfelel a megadott argumentumlistának és -kultúrának. (Öröklődés forrása Type) |
| InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) |
Meghívja a megadott tagot. A meghívni kívánt metódusnak elérhetőnek kell lennie, és a megadott argumentumlistával a legspecifikusabb egyezést kell biztosítania a megadott kötési és meghívási attribútumok korlátozásai mellett. |
| InvokeMember(String, BindingFlags, Binder, Object, Object[]) |
Meghívja a megadott tagot a megadott kötési korlátozások használatával, és megfelel a megadott argumentumlistának. (Öröklődés forrása Type) |
| IsArrayImpl() |
Ha egy származtatott osztályban felül van bírálva, implementálja a IsArray tulajdonságot, és meghatározza, hogy tömb-e Type . (Öröklődés forrása Type) |
| IsAssignableFrom(Type) |
Olyan értéket kap, amely jelzi, hogy egy adott Type objektum hozzárendelhető-e ehhez az objektumhoz. |
| IsAssignableFrom(TypeInfo) |
Olyan értéket kap, amely jelzi, hogy egy adott TypeInfo objektum hozzárendelhető-e ehhez az objektumhoz. |
| IsByRefImpl() |
Ha egy származtatott osztályban felül van bírálva, implementálja a IsByRef tulajdonságot, és meghatározza, hogy a Type tulajdonság hivatkozással lett-e átadva. (Öröklődés forrása Type) |
| IsCOMObjectImpl() |
Ha felül van bírálva egy származtatott osztályban, implementálja a IsCOMObject tulajdonságot, és meghatározza, hogy a Type tulajdonság COM-objektum-e. (Öröklődés forrása Type) |
| IsContextfulImpl() |
Implementálja a IsContextful tulajdonságot, és meghatározza, hogy az Type üzemeltethető-e egy környezetben. (Öröklődés forrása Type) |
| IsCreated() |
Egy értéket ad vissza, amely jelzi, hogy az aktuális dinamikus típus létrejött-e. |
| IsDefined(Type, Boolean) |
Meghatározza, hogy a rendszer alkalmaz-e egyéni attribútumot az aktuális típusra. |
| IsEnumDefined(Object) |
Olyan értéket ad vissza, amely jelzi, hogy a megadott érték létezik-e az aktuális számbavételi típusban. (Öröklődés forrása Type) |
| IsEquivalentTo(Type) |
Meghatározza, hogy két COM-típus azonos identitással rendelkezik-e, és jogosult-e a típusegyenlítésre. (Öröklődés forrása Type) |
| IsInstanceOfType(Object) |
Meghatározza, hogy a megadott objektum az aktuális Typepéldány-e. (Öröklődés forrása Type) |
| IsMarshalByRefImpl() |
Implementálja a IsMarshalByRef tulajdonságot, és meghatározza, hogy a Type tulajdonság hivatkozással van-e meghatározva. (Öröklődés forrása Type) |
| IsPointerImpl() |
Ha egy származtatott osztályban felül van bírálva, implementálja a IsPointer tulajdonságot, és meghatározza, hogy az Type mutató-e. (Öröklődés forrása Type) |
| IsPrimitiveImpl() |
Ha felül van bírálva egy származtatott osztályban, implementálja a IsPrimitive tulajdonságot, és meghatározza, hogy az Type egyik primitív típus-e. (Öröklődés forrása Type) |
| IsSubclassOf(Type) |
Meghatározza, hogy ez a típus egy adott típusból származik-e. |
| IsValueTypeImpl() |
Implementálja a IsValueType tulajdonságot, és meghatározza, hogy a Type tulajdonság értéktípus-e, vagyis nem osztály vagy interfész. (Öröklődés forrása Type) |
| MakeArrayType() |
Olyan objektumot ad Type vissza, amely az aktuális típus egydimenziós tömbjének felel meg, nulla alsó határral. |
| MakeArrayType(Int32) |
Type Egy objektumot ad vissza, amely az aktuális típusú tömböt jelöli a megadott számú dimenzióval. |
| MakeByRefType() |
Egy Type objektumot ad vissza, amely |
| MakeGenericType(Type[]) |
Egy típustömb elemeit helyettesíti az aktuális általános típusdefiníció típusparamétereihez, és visszaadja az eredményül kapott létrehozott típust. |
| MakePointerType() |
Type Olyan objektumot ad vissza, amely egy nem felügyelt mutató típusát jelöli az aktuális típusra. |
| MemberwiseClone() |
Az aktuális Objectpéldány sekély másolatát hozza létre. (Öröklődés forrása Object) |
| SetCustomAttribute(ConstructorInfo, Byte[]) |
Egyéni attribútum beállítása egy megadott egyéni attribútumblob használatával. |
| SetCustomAttribute(CustomAttributeBuilder) |
Egyéni attribútum beállítása egyéni attribútumszerkesztővel. |
| SetParent(Type) |
Beállítja a jelenleg építés alatt álló típus alaptípusát. |
| ToString() |
A névtér nélküli típus nevét adja vissza. |
Explicit interfész-implementációk
| Name | Description |
|---|---|
| _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Névkészletet képez le a küldési azonosítók megfelelő készletére. (Öröklődés forrása MemberInfo) |
| _MemberInfo.GetType() |
Type Lekéri az MemberInfo osztályt jelképező objektumot. (Öröklődés forrása MemberInfo) |
| _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) |
Lekéri egy objektum típusadatait, amelyek aztán a felület típusadatainak lekérésére használhatók. (Öröklődés forrása MemberInfo) |
| _MemberInfo.GetTypeInfoCount(UInt32) |
Lekéri az objektumok által biztosított típusinformációs felületek számát (0 vagy 1). (Öröklődés forrása MemberInfo) |
| _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Hozzáférést biztosít az objektumok által közzétett tulajdonságokhoz és metódusokhoz. (Öröklődés forrása MemberInfo) |
| _Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Névkészletet képez le a küldési azonosítók megfelelő készletére. (Öröklődés forrása Type) |
| _Type.GetTypeInfo(UInt32, UInt32, IntPtr) |
Lekéri egy objektum típusadatait, amelyek aztán a felület típusadatainak lekérésére használhatók. (Öröklődés forrása Type) |
| _Type.GetTypeInfoCount(UInt32) |
Lekéri az objektumok által biztosított típusinformációs felületek számát (0 vagy 1). (Öröklődés forrása Type) |
| _Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Hozzáférést biztosít az objektumok által közzétett tulajdonságokhoz és metódusokhoz. (Öröklődés forrása Type) |
| _TypeBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Névkészletet képez le a küldési azonosítók megfelelő készletére. |
| _TypeBuilder.GetTypeInfo(UInt32, UInt32, IntPtr) |
Lekéri egy objektum típusadatait, amelyek aztán a felület típusadatainak lekérésére használhatók. |
| _TypeBuilder.GetTypeInfoCount(UInt32) |
Lekéri az objektumok által biztosított típusinformációs felületek számát (0 vagy 1). |
| _TypeBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Hozzáférést biztosít az objektumok által közzétett tulajdonságokhoz és metódusokhoz. |
| IReflectableType.GetTypeInfo() |
Az aktuális típus objektumként TypeInfo való ábrázolását adja vissza. (Öröklődés forrása TypeInfo) |
Bővítő metódusok
| Name | Description |
|---|---|
| GetCustomAttribute(MemberInfo, Type, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg. |
| GetCustomAttribute(MemberInfo, Type) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz. |
| GetCustomAttribute<T>(MemberInfo, Boolean) |
Lekéri a megadott típusú egyéni attribútumot, amely egy adott tagra lesz alkalmazva, és opcionálisan az adott tag elődeit vizsgálja meg. |
| GetCustomAttribute<T>(MemberInfo) |
Egy megadott típusú egyéni attribútumot kér le, amelyet egy adott tagra alkalmaz. |
| GetCustomAttributes(MemberInfo, Boolean) |
Lekéri a megadott tagra alkalmazott egyéni attribútumok gyűjteményét, és opcionálisan az adott tag őseit vizsgálja meg. |
| GetCustomAttributes(MemberInfo, Type, Boolean) |
Lekéri a megadott típusú egyéni attribútumok gyűjteményét, amelyek egy adott tagra vonatkoznak, és opcionálisan az adott tag elődeit is érintik. |
| GetCustomAttributes(MemberInfo, Type) |
Egy megadott típusú egyéni attribútumok gyűjteményét kéri le, amelyeket egy adott tagra alkalmaz. |
| GetCustomAttributes(MemberInfo) |
Egy adott tagra alkalmazott egyéni attribútumok gyűjteményét kéri le. |
| GetCustomAttributes<T>(MemberInfo, Boolean) |
Lekéri a megadott típusú egyéni attribútumok gyűjteményét, amelyek egy adott tagra vonatkoznak, és opcionálisan az adott tag elődeit is érintik. |
| GetCustomAttributes<T>(MemberInfo) |
Egy megadott típusú egyéni attribútumok gyűjteményét kéri le, amelyeket egy adott tagra alkalmaz. |
| GetRuntimeEvent(Type, String) |
Lekéri a megadott eseményt jelképező objektumot. |
| GetRuntimeEvents(Type) |
Egy gyűjteményt kér le, amely egy adott típuson definiált összes eseményt jelöli. |
| GetRuntimeField(Type, String) |
Egy adott mezőt képviselő objektumot kér le. |
| GetRuntimeFields(Type) |
Beolvas egy gyűjteményt, amely egy adott típuson definiált összes mezőt jelöli. |
| GetRuntimeInterfaceMap(TypeInfo, Type) |
A megadott típushoz és a megadott felülethez tartozó illesztőleképezést adja vissza. |
| GetRuntimeMethod(Type, String, Type[]) |
Egy megadott metódust képviselő objektumot kér le. |
| GetRuntimeMethods(Type) |
Lekéri a megadott típuson definiált összes metódust képviselő gyűjteményt. |
| GetRuntimeProperties(Type) |
Lekéri a megadott típuson definiált összes tulajdonságot képviselő gyűjteményt. |
| GetRuntimeProperty(Type, String) |
Egy adott tulajdonságot képviselő objektumot kér le. |
| GetTypeInfo(Type) |
TypeInfo A megadott típus ábrázolását adja vissza. |
| IsDefined(MemberInfo, Type, Boolean) |
Azt jelzi, hogy a megadott típusú egyéni attribútumok alkalmazhatók-e egy adott tagra, és szükség esetén alkalmazva vannak-e az elődökre. |
| IsDefined(MemberInfo, Type) |
Azt jelzi, hogy a megadott típusú egyéni attribútumok alkalmazhatók-e egy adott tagra. |