PropertyBuilder PropertyBuilder PropertyBuilder PropertyBuilder Class

定義

型のプロパティを定義します。Defines the properties for a type.

public ref class PropertyBuilder sealed : System::Reflection::PropertyInfo, System::Runtime::InteropServices::_PropertyBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class PropertyBuilder : System.Reflection.PropertyInfo, System.Runtime.InteropServices._PropertyBuilder
type PropertyBuilder = class
    inherit PropertyInfo
    interface _PropertyBuilder
Public NotInheritable Class PropertyBuilder
Inherits PropertyInfo
Implements _PropertyBuilder
継承
属性
実装

次のコードサンプルでは、でPropertyBuilder TypeBuilder.DefineProperty取得したを使用してプロパティフレームワークを作成し、関連付けられMethodBuilderたを使用してプロパティに IL ロジックを実装することにより、プロパティを動的な型で実装する方法を示します。The following code sample demonstrates how to implement properties in a dynamic type using a PropertyBuilder obtained via TypeBuilder.DefineProperty to create the property framework and an associated MethodBuilder to implement the IL logic within the property.

using namespace System;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
Type^ BuildDynamicTypeWithProperties()
{
   AppDomain^ myDomain = Thread::GetDomain();
   AssemblyName^ myAsmName = gcnew AssemblyName;
   myAsmName->Name = "MyDynamicAssembly";
   
   // To generate a persistable assembly, specify AssemblyBuilderAccess::RunAndSave.
   AssemblyBuilder^ myAsmBuilder = 
       myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
   
   // Generate a persistable single-module assembly.
   ModuleBuilder^ myModBuilder = 
       myAsmBuilder->DefineDynamicModule( myAsmName->Name, myAsmName->Name + ".dll" );
   TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public );

   // Define a private field to hold the property value.
   FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private );
   
   // The last argument of DefineProperty is an empty array of Type
   // objects, because the property has no parameters. (Alternatively,
   // you can specify a null value.)
   PropertyBuilder^ custNamePropBldr = 
       myTypeBuilder->DefineProperty( "CustomerName", PropertyAttributes::HasDefault, String::typeid, gcnew array<Type^>(0) );
   
   // 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 CustomerName.
   MethodBuilder^ custNameGetPropMthdBldr = 
       myTypeBuilder->DefineMethod( "get_CustomerName", 
                                    getSetAttr,
                                    String::typeid, 
                                    Type::EmptyTypes );

   ILGenerator^ custNameGetIL = custNameGetPropMthdBldr->GetILGenerator();
   custNameGetIL->Emit( OpCodes::Ldarg_0 );
   custNameGetIL->Emit( OpCodes::Ldfld, customerNameBldr );
   custNameGetIL->Emit( OpCodes::Ret );
   
   // Define the "set" accessor method for CustomerName.
   array<Type^>^temp2 = {String::typeid};
   MethodBuilder^ custNameSetPropMthdBldr = 
       myTypeBuilder->DefineMethod( "set_CustomerName", 
                                    getSetAttr,
                                    nullptr, 
                                    temp2 );

   ILGenerator^ custNameSetIL = custNameSetPropMthdBldr->GetILGenerator();
   custNameSetIL->Emit( OpCodes::Ldarg_0 );
   custNameSetIL->Emit( OpCodes::Ldarg_1 );
   custNameSetIL->Emit( OpCodes::Stfld, customerNameBldr );
   custNameSetIL->Emit( OpCodes::Ret );
   
   // Last, we must map the two methods created above to our PropertyBuilder to
   // their corresponding behaviors, "get" and "set" respectively.
   custNamePropBldr->SetGetMethod( custNameGetPropMthdBldr );
   custNamePropBldr->SetSetMethod( custNameSetPropMthdBldr );

   Type^ retval = myTypeBuilder->CreateType();

   // Save the assembly so it can be examined with Ildasm.exe,
   // or referenced by a test program.
   myAsmBuilder->Save(myAsmName->Name + ".dll");
   return retval;
}

int main()
{
   Type^ custDataType = BuildDynamicTypeWithProperties();
   array<PropertyInfo^>^custDataPropInfo = custDataType->GetProperties();
   System::Collections::IEnumerator^ myEnum = custDataPropInfo->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      PropertyInfo^ pInfo = safe_cast<PropertyInfo^>(myEnum->Current);
      Console::WriteLine( "Property '{0}' created!", pInfo );
   }

   Console::WriteLine( "---" );
   
   // Note that when invoking a property, you need to use the proper BindingFlags -
   // BindingFlags::SetProperty when you invoke the "set" behavior, and
   // BindingFlags::GetProperty when you invoke the "get" behavior. Also note that
   // we invoke them based on the name we gave the property, as expected, and not
   // the name of the methods we bound to the specific property behaviors.
   Object^ custData = Activator::CreateInstance( custDataType );
   array<Object^>^temp3 = {"Joe User"};
   custDataType->InvokeMember( "CustomerName", BindingFlags::SetProperty, nullptr, custData, temp3 );
   Console::WriteLine( "The customerName field of instance custData has been set to '{0}'.", custDataType->InvokeMember( "CustomerName", BindingFlags::GetProperty, nullptr, custData, gcnew array<Object^>(0) ) );
}

// --- O U T P U T ---
// The output should be as follows:
// -------------------
// Property 'System.String CustomerName' created!
// ---
// The customerName field of instance custData has been set to 'Joe User'.
// -------------------

using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class PropertyBuilderDemo

{

   public static Type BuildDynamicTypeWithProperties() 
   {
        AppDomain myDomain = Thread.GetDomain();
        AssemblyName myAsmName = new AssemblyName();
        myAsmName.Name = "MyDynamicAssembly";

        // To generate a persistable assembly, specify AssemblyBuilderAccess.RunAndSave.
        AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(myAsmName,
                                                        AssemblyBuilderAccess.RunAndSave);
        // Generate a persistable single-module assembly.
        ModuleBuilder myModBuilder = 
            myAsmBuilder.DefineDynamicModule(myAsmName.Name, myAsmName.Name + ".dll");

        TypeBuilder myTypeBuilder = myModBuilder.DefineType("CustomerData", 
                                                        TypeAttributes.Public);

        FieldBuilder customerNameBldr = myTypeBuilder.DefineField("customerName",
                                                        typeof(string),
                                                        FieldAttributes.Private);

        // 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 an array with no elements: new Type[] {})
        PropertyBuilder custNamePropBldr = myTypeBuilder.DefineProperty("CustomerName",
                                                         PropertyAttributes.HasDefault,
                                                         typeof(string),
                                                         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 CustomerName.
        MethodBuilder custNameGetPropMthdBldr = 
            myTypeBuilder.DefineMethod("get_CustomerName",
                                       getSetAttr,        
                                       typeof(string),
                                       Type.EmptyTypes);

        ILGenerator custNameGetIL = custNameGetPropMthdBldr.GetILGenerator();

        custNameGetIL.Emit(OpCodes.Ldarg_0);
        custNameGetIL.Emit(OpCodes.Ldfld, customerNameBldr);
        custNameGetIL.Emit(OpCodes.Ret);

        // Define the "set" accessor method for CustomerName.
        MethodBuilder custNameSetPropMthdBldr = 
            myTypeBuilder.DefineMethod("set_CustomerName",
                                       getSetAttr,     
                                       null,
                                       new Type[] { typeof(string) });

        ILGenerator custNameSetIL = custNameSetPropMthdBldr.GetILGenerator();

        custNameSetIL.Emit(OpCodes.Ldarg_0);
        custNameSetIL.Emit(OpCodes.Ldarg_1);
        custNameSetIL.Emit(OpCodes.Stfld, customerNameBldr);
        custNameSetIL.Emit(OpCodes.Ret);

        // Last, we must map the two methods created above to our PropertyBuilder to 
        // their corresponding behaviors, "get" and "set" respectively. 
        custNamePropBldr.SetGetMethod(custNameGetPropMthdBldr);
        custNamePropBldr.SetSetMethod(custNameSetPropMthdBldr);


        Type retval = myTypeBuilder.CreateType();

        // Save the assembly so it can be examined with Ildasm.exe,
        // or referenced by a test program.
        myAsmBuilder.Save(myAsmName.Name + ".dll");
        return retval;
   }

   public static void Main() 
   {
        Type custDataType = BuildDynamicTypeWithProperties();
        
        PropertyInfo[] custDataPropInfo = custDataType.GetProperties();
        foreach (PropertyInfo pInfo in custDataPropInfo) {
           Console.WriteLine("Property '{0}' created!", pInfo.ToString());
        }

        Console.WriteLine("---");
        // Note that when invoking a property, you need to use the proper BindingFlags -
        // BindingFlags.SetProperty when you invoke the "set" behavior, and 
        // BindingFlags.GetProperty when you invoke the "get" behavior. Also note that
        // we invoke them based on the name we gave the property, as expected, and not
        // the name of the methods we bound to the specific property behaviors.

        object custData = Activator.CreateInstance(custDataType);
        custDataType.InvokeMember("CustomerName", BindingFlags.SetProperty,
                                      null, custData, new object[]{ "Joe User" });

        Console.WriteLine("The customerName field of instance custData has been set to '{0}'.",
                           custDataType.InvokeMember("CustomerName", BindingFlags.GetProperty,
                                                      null, custData, new object[]{ }));
   }

}

// --- O U T P U T ---
// The output should be as follows:
// -------------------
// Property 'System.String CustomerName' created!
// ---
// The customerName field of instance custData has been set to 'Joe User'.
// -------------------

Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit

Class PropertyBuilderDemo
   
   Public Shared Function BuildDynamicTypeWithProperties() As Type
      Dim myDomain As AppDomain = Thread.GetDomain()
      Dim myAsmName As New AssemblyName()
      myAsmName.Name = "MyDynamicAssembly"
      
      ' To generate a persistable assembly, specify AssemblyBuilderAccess.RunAndSave.
      Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly(myAsmName, _
                                                        AssemblyBuilderAccess.RunAndSave)
      
      ' Generate a persistable, single-module assembly.
      Dim myModBuilder As ModuleBuilder = _
          myAsmBuilder.DefineDynamicModule(myAsmName.Name, myAsmName.Name & ".dll")
      
      Dim myTypeBuilder As TypeBuilder = myModBuilder.DefineType("CustomerData", TypeAttributes.Public)
      
      ' Define a private field to hold the property value.
      Dim customerNameBldr As FieldBuilder = myTypeBuilder.DefineField("customerName", _
                                             GetType(String), FieldAttributes.Private)
      
      ' 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 an array with no elements: New Type() {})
      Dim custNamePropBldr As PropertyBuilder = _
          myTypeBuilder.DefineProperty("CustomerName", _
                                       PropertyAttributes.HasDefault, _
                                       GetType(String), _
                                       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 CustomerName.
      Dim custNameGetPropMthdBldr As MethodBuilder = _
          myTypeBuilder.DefineMethod("GetCustomerName", _
                                     getSetAttr, _
                                     GetType(String), _
                                     Type.EmptyTypes)
      
      Dim custNameGetIL As ILGenerator = custNameGetPropMthdBldr.GetILGenerator()
      
      custNameGetIL.Emit(OpCodes.Ldarg_0)
      custNameGetIL.Emit(OpCodes.Ldfld, customerNameBldr)
      custNameGetIL.Emit(OpCodes.Ret)
      
      ' Define the "set" accessor method for CustomerName.
      Dim custNameSetPropMthdBldr As MethodBuilder = _
          myTypeBuilder.DefineMethod("get_CustomerName", _
                                     getSetAttr, _
                                     Nothing, _
                                     New Type() {GetType(String)})
      
      Dim custNameSetIL As ILGenerator = custNameSetPropMthdBldr.GetILGenerator()
      
      custNameSetIL.Emit(OpCodes.Ldarg_0)
      custNameSetIL.Emit(OpCodes.Ldarg_1)
      custNameSetIL.Emit(OpCodes.Stfld, customerNameBldr)
      custNameSetIL.Emit(OpCodes.Ret)
      
      ' Last, we must map the two methods created above to our PropertyBuilder to 
      ' their corresponding behaviors, "get" and "set" respectively. 
      custNamePropBldr.SetGetMethod(custNameGetPropMthdBldr)
      custNamePropBldr.SetSetMethod(custNameSetPropMthdBldr)
            
      Dim retval As Type = myTypeBuilder.CreateType()

      ' Save the assembly so it can be examined with Ildasm.exe,
      ' or referenced by a test program.
      myAsmBuilder.Save(myAsmName.Name & ".dll")
      return retval
   End Function 'BuildDynamicTypeWithProperties
    
   
   Public Shared Sub Main()
      Dim custDataType As Type = BuildDynamicTypeWithProperties()
      
      Dim custDataPropInfo As PropertyInfo() = custDataType.GetProperties()
      Dim pInfo As PropertyInfo
      For Each pInfo In  custDataPropInfo
         Console.WriteLine("Property '{0}' created!", pInfo.ToString())
      Next pInfo
      
      Console.WriteLine("---")
      ' Note that when invoking a property, you need to use the proper BindingFlags -
      ' BindingFlags.SetProperty when you invoke the "set" behavior, and 
      ' BindingFlags.GetProperty when you invoke the "get" behavior. Also note that
      ' we invoke them based on the name we gave the property, as expected, and not
      ' the name of the methods we bound to the specific property behaviors.
      Dim custData As Object = Activator.CreateInstance(custDataType)
      custDataType.InvokeMember("CustomerName", BindingFlags.SetProperty, Nothing, _
                                custData, New Object() {"Joe User"})
      
      Console.WriteLine("The customerName field of instance custData has been set to '{0}'.", _
                        custDataType.InvokeMember("CustomerName", BindingFlags.GetProperty, _
                        Nothing, custData, New Object() {}))
   End Sub 'Main
End Class 'PropertyBuilderDemo


' --- O U T P U T ---
' The output should be as follows:
' -------------------
' Property 'System.String CustomerName' created!
' ---
' The customerName field of instance custData has been set to 'Joe User'.
' -------------------

注釈

PropertyBuilderは、TypeBuilder常にに関連付けられています。A PropertyBuilder is always associated with a TypeBuilder. TypeBuilderThe TypeBuilder. DefinePropertyメソッドは、新しいPropertyBuilderをクライアントに返します。DefineProperty method will return a new PropertyBuilder to a client.

プロパティ

Attributes Attributes Attributes Attributes

このプロパティの属性を取得します。Gets the attributes for this property.

CanRead CanRead CanRead CanRead

プロパティを読み取ることができるかどうかを示す値を取得します。Gets a value indicating whether the property can be read.

CanWrite CanWrite CanWrite CanWrite

プロパティに書き込むことができるかどうかを示す値を取得します。Gets a value indicating whether the property can be written to.

CustomAttributes CustomAttributes CustomAttributes CustomAttributes

このメンバーのカスタム属性を含むコレクションを取得します。Gets a collection that contains this member's custom attributes.

(Inherited from MemberInfo)
DeclaringType DeclaringType DeclaringType DeclaringType

このメンバーを宣言するクラスを取得します。Gets the class that declares this member.

GetMethod GetMethod GetMethod GetMethod

このプロパティの get アクセサーを取得します。Gets the get accessor for this property.

(Inherited from PropertyInfo)
IsCollectible IsCollectible IsCollectible IsCollectible

この MemberInfo オブジェクトが、収集可能な AssemblyLoadContext に保持されているアセンブリの一部であるかどうかを示す値を取得します。Gets a value that indicates whether this MemberInfo object is part of an assembly held in a collectible AssemblyLoadContext.

(Inherited from MemberInfo)
IsSpecialName IsSpecialName IsSpecialName IsSpecialName

特別な名前のプロパティかどうかを示す値を取得します。Gets a value indicating whether the property is the special name.

(Inherited from PropertyInfo)
MemberType MemberType MemberType MemberType

このメンバーがプロパティであることを示す MemberTypes 値を取得します。Gets a MemberTypes value indicating that this member is a property.

(Inherited from PropertyInfo)
MetadataToken MetadataToken MetadataToken MetadataToken

メタデータ要素を識別する値を取得します。Gets a value that identifies a metadata element.

(Inherited from MemberInfo)
Module Module Module Module

現在のプロパティを宣言している型が定義されているモジュールを取得します。Gets the module in which the type that declares the current property is being defined.

Name Name Name Name

このメンバーの名前を取得します。Gets the name of this member.

PropertyToken PropertyToken PropertyToken PropertyToken

このプロパティのトークンを取得します。Retrieves the token for this property.

PropertyType PropertyType PropertyType PropertyType

このプロパティのフィールドの型を取得します。Gets the type of the field of this property.

ReflectedType ReflectedType ReflectedType ReflectedType

MemberInfo のこのインスタンスを取得するために使用したクラス オブジェクトを取得します。Gets the class object that was used to obtain this instance of MemberInfo.

SetMethod SetMethod SetMethod SetMethod

このプロパティの set アクセサーを取得します。Gets the set accessor for this property.

(Inherited from PropertyInfo)

メソッド

AddOtherMethod(MethodBuilder) AddOtherMethod(MethodBuilder) AddOtherMethod(MethodBuilder) AddOtherMethod(MethodBuilder)

このプロパティに関連付ける別のメソッドを追加します。Adds one of the other methods associated with this property.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from PropertyInfo)
GetAccessors() GetAccessors() GetAccessors() GetAccessors()

現在のインスタンスがリフレクションしているプロパティの、パブリックな get アクセサー、および set アクセサーをリフレクションする要素で構成される配列を返します。Returns an array whose elements reflect the public get and set accessors of the property reflected by the current instance.

(Inherited from PropertyInfo)
GetAccessors(Boolean) GetAccessors(Boolean) GetAccessors(Boolean) GetAccessors(Boolean)

このプロパティのパブリックおよび非パブリックな get アクセサーと set アクセサーの配列を返します。Returns an array of the public and non-public get and set accessors on this property.

GetConstantValue() GetConstantValue() GetConstantValue() GetConstantValue()

コンパイラによってプロパティに関連付けられているリテラル値を返します。Returns a literal value associated with the property by a compiler.

(Inherited from PropertyInfo)
GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean)

このプロパティのすべてのカスタム属性の配列を返します。Returns an array of all the custom attributes for this property.

GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean)

Type によって識別されるカスタム属性の配列を返します。Returns an array of custom attributes identified by Type.

GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData()

ターゲット メンバーに適用されている属性に関するデータを表す CustomAttributeData オブジェクトのリストを返します。Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.

(Inherited from MemberInfo)
GetGetMethod() GetGetMethod() GetGetMethod() GetGetMethod()

このプロパティのパブリックな get アクセサーを返します。Returns the public get accessor for this property.

(Inherited from PropertyInfo)
GetGetMethod(Boolean) GetGetMethod(Boolean) GetGetMethod(Boolean) GetGetMethod(Boolean)

このプロパティのパブリックおよび非パブリックな get アクセサーを返します。Returns the public and non-public get accessor for this property.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

このインスタンスのハッシュ コードを返します。Returns the hash code for this instance.

(Inherited from PropertyInfo)
GetIndexParameters() GetIndexParameters() GetIndexParameters() GetIndexParameters()

プロパティのすべてのインデックス パラメーターの配列を返します。Returns an array of all the index parameters for the property.

GetOptionalCustomModifiers() GetOptionalCustomModifiers() GetOptionalCustomModifiers() GetOptionalCustomModifiers()

プロパティのオプションのカスタム修飾子を表す型の配列を返します。Returns an array of types representing the optional custom modifiers of the property.

(Inherited from PropertyInfo)
GetRawConstantValue() GetRawConstantValue() GetRawConstantValue() GetRawConstantValue()

コンパイラによってプロパティに関連付けられているリテラル値を返します。Returns a literal value associated with the property by a compiler.

(Inherited from PropertyInfo)
GetRequiredCustomModifiers() GetRequiredCustomModifiers() GetRequiredCustomModifiers() GetRequiredCustomModifiers()

プロパティの必須のカスタム修飾子を表す型の配列を返します。Returns an array of types representing the required custom modifiers of the property.

(Inherited from PropertyInfo)
GetSetMethod() GetSetMethod() GetSetMethod() GetSetMethod()

このプロパティのパブリックな set アクセサーを返します。Returns the public set accessor for this property.

(Inherited from PropertyInfo)
GetSetMethod(Boolean) GetSetMethod(Boolean) GetSetMethod(Boolean) GetSetMethod(Boolean)

このプロパティの set アクセサーを返します。Returns the set accessor for this property.

GetType() GetType() GetType() GetType() Inherited from PropertyInfo
GetValue(Object) GetValue(Object) GetValue(Object) GetValue(Object)

指定されたオブジェクトのプロパティの値を返します。Returns the property value of a specified object.

(Inherited from PropertyInfo)
GetValue(Object, BindingFlags, Binder, Object[], CultureInfo) GetValue(Object, BindingFlags, Binder, Object[], CultureInfo) GetValue(Object, BindingFlags, Binder, Object[], CultureInfo) GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)

指定したバインディング、インデックス、および CultureInfo のプロパティの値を取得します。Gets the value of a property having the specified binding, index, and CultureInfo.

GetValue(Object, Object[]) GetValue(Object, Object[]) GetValue(Object, Object[]) GetValue(Object, Object[])

プロパティの取得側メソッドを呼び出して、インデックス付きプロパティの値を取得します。Gets the value of the indexed property by calling the property's getter method.

HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) Inherited from MemberInfo
IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean)

このプロパティに attributeType のインスタンスが 1 つ以上定義されているかどうかを示します。Indicates whether one or more instance of attributeType is defined on this property.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
SetConstant(Object) SetConstant(Object) SetConstant(Object) SetConstant(Object)

このプロパティの既定値を設定します。Sets the default value of this property.

SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[])

指定されたカスタム属性 BLOB を使用して、カスタム属性を設定します。Set a custom attribute using a specified custom attribute blob.

SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder)

カスタム属性ビルダーを使用して、カスタム属性を設定します。Set a custom attribute using a custom attribute builder.

SetGetMethod(MethodBuilder) SetGetMethod(MethodBuilder) SetGetMethod(MethodBuilder) SetGetMethod(MethodBuilder)

プロパティ値を取得するメソッドを設定します。Sets the method that gets the property value.

SetSetMethod(MethodBuilder) SetSetMethod(MethodBuilder) SetSetMethod(MethodBuilder) SetSetMethod(MethodBuilder)

プロパティ値を設定するメソッドを設定します。Sets the method that sets the property value.

SetValue(Object, Object) SetValue(Object, Object) SetValue(Object, Object) SetValue(Object, Object)

指定されたオブジェクトのプロパティの値を設定します。Sets the property value of a specified object.

(Inherited from PropertyInfo)
SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)

指定したオブジェクトのプロパティ値に、指定した値を設定します。Sets the property value for the given object to the given value.

SetValue(Object, Object, Object[]) SetValue(Object, Object, Object[]) SetValue(Object, Object, Object[]) SetValue(Object, Object, Object[])

プロパティの値を設定します。インデックス付きプロパティの場合は、オプションでインデックス値を設定できます。Sets the value of the property with optional index values for index properties.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

明示的なインターフェイスの実装

ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) Inherited from MemberInfo
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) Inherited from MemberInfo
ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) Inherited from MemberInfo
_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from MemberInfo)
_MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType()

Type クラスを表す MemberInfo オブジェクトを取得します。Gets a Type object representing the MemberInfo class.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この型情報を使用して、インターフェイスの型情報を取得できます。Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。Provides access to properties and methods exposed by an object.

(Inherited from MemberInfo)
_PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。Maps a set of names to a corresponding set of dispatch identifiers.

_PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この型情報を使用して、インターフェイスの型情報を取得できます。Retrieves the type information for an object, which can then be used to get the type information for an interface.

_PropertyBuilder.GetTypeInfoCount(UInt32) _PropertyBuilder.GetTypeInfoCount(UInt32) _PropertyBuilder.GetTypeInfoCount(UInt32) _PropertyBuilder.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

_PropertyBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。Provides access to properties and methods exposed by an object.

_PropertyInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _PropertyInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from PropertyInfo)
_PropertyInfo.GetType() _PropertyInfo.GetType() _PropertyInfo.GetType() _PropertyInfo.GetType()

Type 型を表す PropertyInfo オブジェクトを取得します。Gets a Type object representing the PropertyInfo type.

(Inherited from PropertyInfo)
_PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この型情報を使用して、インターフェイスの型情報を取得できます。Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from PropertyInfo)
_PropertyInfo.GetTypeInfoCount(UInt32) _PropertyInfo.GetTypeInfoCount(UInt32) _PropertyInfo.GetTypeInfoCount(UInt32) _PropertyInfo.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from PropertyInfo)
_PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。Provides access to properties and methods exposed by an object.

(Inherited from PropertyInfo)

拡張メソッド

GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type)

指定したメンバーに適用される指定した型のカスタム属性を取得します。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean)

指定したメンバーに適用される指定した型のカスタム属性を取得し、オプションでそのメンバーの先祖を調べます。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo)

指定したメンバーに適用される指定した型のカスタム属性を取得します。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean)

指定したメンバーに適用される指定した型のカスタム属性を取得し、オプションでそのメンバーの先祖を調べます。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo)

指定されたメンバーに適用されるカスタム属性のコレクションを取得します。Retrieves a collection of custom attributes that are applied to a specified member.

GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean)

指定されたメンバーに適用されるカスタム属性のコレクションを取得し、オプションでそのメンバーの先祖を調べます。Retrieves a collection of custom attributes that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type)

指定されたメンバーに適用される指定された型のカスタム属性のコレクションを取得します。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean)

指定されたメンバーに適用されている指定された型のカスタム属性のコレクションを取得し、オプションでそのメンバーの先祖を調べます。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo)

指定されたメンバーに適用される指定された型のカスタム属性のコレクションを取得します。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean)

指定されたメンバーに適用されている指定された型のカスタム属性のコレクションを取得し、オプションでそのメンバーの先祖を調べます。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type)

指定された型のカスタム属性が指定されたメンバーに適用されているかどうかを示します。Indicates whether custom attributes of a specified type are applied to a specified member.

IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean)

指定された型のカスタム属性が指定されたメンバーに適用され、オプションで先祖に適用されているかどうかを示します。Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo)

指定されたメンバーのメタデータ トークンを取得します (存在する場合)。Gets a metadata token for the given member, if available.

HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo)

指定されたメンバーに対してメタデータ トークンを使用できるかどうかを示す値を返します。Returns a value that indicates whether a metadata token is available for the specified member.

GetAccessors(PropertyInfo) GetAccessors(PropertyInfo) GetAccessors(PropertyInfo) GetAccessors(PropertyInfo)
GetAccessors(PropertyInfo, Boolean) GetAccessors(PropertyInfo, Boolean) GetAccessors(PropertyInfo, Boolean) GetAccessors(PropertyInfo, Boolean)
GetGetMethod(PropertyInfo) GetGetMethod(PropertyInfo) GetGetMethod(PropertyInfo) GetGetMethod(PropertyInfo)
GetGetMethod(PropertyInfo, Boolean) GetGetMethod(PropertyInfo, Boolean) GetGetMethod(PropertyInfo, Boolean) GetGetMethod(PropertyInfo, Boolean)
GetSetMethod(PropertyInfo) GetSetMethod(PropertyInfo) GetSetMethod(PropertyInfo) GetSetMethod(PropertyInfo)
GetSetMethod(PropertyInfo, Boolean) GetSetMethod(PropertyInfo, Boolean) GetSetMethod(PropertyInfo, Boolean) GetSetMethod(PropertyInfo, Boolean)

適用対象