EventAttributes 列挙体とは? わかりやすく解説

EventAttributes 列挙体

イベント属性指定します

この列挙体には、メンバ値のビットごとの組み合わせ可能にする FlagsAttribute 属性含まれています。

名前空間: System.Reflection
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<FlagsAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration EventAttributes
Dim instance As EventAttributes
[SerializableAttribute] 
[FlagsAttribute] 
[ComVisibleAttribute(true)] 
public enum EventAttributes
[SerializableAttribute] 
[FlagsAttribute] 
[ComVisibleAttribute(true)] 
public enum class EventAttributes
/** @attribute SerializableAttribute() */ 
/** @attribute FlagsAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum EventAttributes
SerializableAttribute 
FlagsAttribute 
ComVisibleAttribute(true) 
public enum EventAttributes
メンバメンバ
 メンバ説明
.NET Compact Framework によるサポートNoneイベント属性がないことを指定します。 
.NET Compact Framework によるサポートReservedMask共通言語ランタイム専用として予約済みフラグ指定します。 
.NET Compact Framework によるサポートRTSpecialName共通言語ランタイムが名前のエンコード方式チェックする必要があることを指定します。 
.NET Compact Framework によるサポートSpecialNameイベントが特別であることを、名前で示すという方法指定します。 
解説解説
使用例使用例
Imports System
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit

Public Class MyApplication

   Delegate Sub MyEvent(temp As
 Object)

   Public Shared Sub Main()
      Dim helloWorldClass As TypeBuilder =
 CreateCallee(Thread.GetDomain())

      Dim info As EventInfo() = helloWorldClass.GetEvents(BindingFlags.Public
 Or _
                                                          BindingFlags.Instance)
      Console.WriteLine("'HelloWorld' type has following events
 :")
      Dim i As Integer
      For i = 0 To info.Length - 1
         Console.WriteLine(info(i).Name)
      Next i
   End Sub 'Main

   ' Create the callee transient dynamic assembly.
   Private Shared Function
 CreateCallee(myDomain As AppDomain) As TypeBuilder
      Dim myAssemblyName As New
 AssemblyName()
      myAssemblyName.Name = "EmittedAssembly"

      ' Create the callee dynamic assembly.
      Dim myAssembly As AssemblyBuilder = myDomain.DefineDynamicAssembly
 _
                                          (myAssemblyName, AssemblyBuilderAccess.Run)
      ' Create a dynamic module named "CalleeModule" in the
 callee
      Dim myModule As ModuleBuilder = myAssembly.DefineDynamicModule("EmittedModule")

      ' Define a public class named "HelloWorld" in the assembly.
      Dim helloWorldClass As TypeBuilder =
 myModule.DefineType _
                                           ("HelloWorld",
 TypeAttributes.Public)

      Dim myMethod1 As MethodBuilder = helloWorldClass.DefineMethod
 _
                    ("OnClick", MethodAttributes.Public,
 Nothing, New Type() {GetType(Object)})
      Dim methodIL1 As ILGenerator = myMethod1.GetILGenerator()
      methodIL1.Emit(OpCodes.Ret)
      Dim myMethod2 As MethodBuilder = helloWorldClass.DefineMethod
 _
                   ("OnMouseUp", MethodAttributes.Public,
 Nothing, New Type() {GetType(Object)})
      Dim methodIL2 As ILGenerator = myMethod2.GetILGenerator()
      methodIL2.Emit(OpCodes.Ret)

      ' Create the events.
      Dim myEvent1 As EventBuilder = helloWorldClass.DefineEvent
 _
                                         ("Click",
 EventAttributes.None, GetType(MyEvent))
      myEvent1.SetRaiseMethod(myMethod1)
      Dim myEvent2 As EventBuilder = helloWorldClass.DefineEvent
 _
                                         ("MouseUp",
 EventAttributes.None, GetType(MyEvent))
      myEvent2.SetRaiseMethod(myMethod2)

      helloWorldClass.CreateType()
      Return helloWorldClass
   End Function 'CreateCallee
End Class 'MyApplication
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;


public class MyApplication
{
   public delegate void MyEvent(Object temp);
   public static void Main()
   {
      TypeBuilder helloWorldClass = CreateCallee(Thread.GetDomain());

      EventInfo[] info =
         helloWorldClass.GetEvents(BindingFlags.Public | BindingFlags.Instance);
      Console.WriteLine("'HelloWorld' type has following events :");
      for(int i=0; i < info.Length; i++)
         Console.WriteLine(info[i].Name);
   }

   // Create the callee transient dynamic assembly.
   private static TypeBuilder CreateCallee(AppDomain
 myDomain)
   {
      AssemblyName assemblyName = new AssemblyName();
      assemblyName.Name = "EmittedAssembly";

      // Create the callee dynamic assembly.
      AssemblyBuilder myAssembly =
         myDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
      // Create a dynamic module named "CalleeModule" in the
 callee.
      ModuleBuilder myModule = myAssembly.DefineDynamicModule("EmittedModule");

      // Define a public class named "HelloWorld" in the assembly.
      TypeBuilder helloWorldClass =
         myModule.DefineType("HelloWorld", TypeAttributes.Public);

      MethodBuilder myMethod1 = helloWorldClass.DefineMethod("OnClick"
,
         MethodAttributes.Public, typeof(void), new
 Type[]{typeof(Object)});
      ILGenerator methodIL1 = myMethod1.GetILGenerator();
      methodIL1.Emit(OpCodes.Ret);
      MethodBuilder myMethod2 = helloWorldClass.DefineMethod("OnMouseUp"
,
         MethodAttributes.Public, typeof(void), new
 Type[]{typeof(Object)});
      ILGenerator methodIL2 = myMethod2.GetILGenerator();
      methodIL2.Emit(OpCodes.Ret);

      // Create the events.
      EventBuilder myEvent1 = helloWorldClass.DefineEvent("Click", EventAttributes.None
,
         typeof(MyEvent));
      myEvent1.SetRaiseMethod(myMethod1);
      EventBuilder myEvent2 = helloWorldClass.DefineEvent("MouseUp", EventAttributes.None
,
         typeof(MyEvent));
      myEvent2.SetRaiseMethod(myMethod2);

      helloWorldClass.CreateType();
      return(helloWorldClass);
   }
}
using namespace System;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Reflection::Emit;

ref class MyApplication
{
private:
   delegate void MyEvent( Object^ temp );

public:

   // Create the callee transient dynamic assembly.
   static TypeBuilder^ CreateCallee( AppDomain^ myDomain )
   {
      AssemblyName^ assemblyName = gcnew AssemblyName;
      assemblyName->Name = "EmittedAssembly";
      
      // Create the callee dynamic assembly.
      AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( assemblyName,
 AssemblyBuilderAccess::Run );
      
      // Create a dynamic module
      ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule"
 );
      
      // Define a public class named "HelloWorld" in the assembly.
      TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld",
 TypeAttributes::Public );
      array<Type^>^typeArray = gcnew array<Type^>(1);
      typeArray[ 0 ] = Object::typeid;
      MethodBuilder^ myMethod1 = helloWorldClass->DefineMethod( "OnClick",
 MethodAttributes::Public, void::typeid, typeArray );
      ILGenerator^ methodIL1 = myMethod1->GetILGenerator();
      methodIL1->Emit( OpCodes::Ret );
      MethodBuilder^ myMethod2 = helloWorldClass->DefineMethod( "OnMouseUp",
 MethodAttributes::Public, void::typeid, typeArray );
      ILGenerator^ methodIL2 = myMethod2->GetILGenerator();
      methodIL2->Emit( OpCodes::Ret );
      
      // Create the events.
      EventBuilder^ myEvent1 = helloWorldClass->DefineEvent( "Click",
 EventAttributes::None, MyEvent::typeid );
      myEvent1->SetRaiseMethod( myMethod1 );
      EventBuilder^ myEvent2 = helloWorldClass->DefineEvent( "MouseUp",
 EventAttributes::None, MyEvent::typeid );
      myEvent2->SetRaiseMethod( myMethod2 );
      helloWorldClass->CreateType();
      return (helloWorldClass);
   }
};

int main()
{
   TypeBuilder^ helloWorldClass = MyApplication::CreateCallee( Thread::GetDomain()
 );
   array<EventInfo^>^info = helloWorldClass->GetEvents( static_cast<BindingFlags>(BindingFlags::Public
 | BindingFlags::Instance) );
   Console::WriteLine( "'HelloWorld' type has following events :" );
   for ( int i = 0; i < info->Length;
 i++ )
      Console::WriteLine( info[ i ]->Name );
   return 0;
}
import System.*;
import System.Threading.*;
import System.Reflection.*;
import System.Reflection.Emit.*;

public class MyApplication
{
    /** @delegate 
     */
    public delegate void MyEvent(Object temp);

    public static void main(String[]
 args)
    {
        TypeBuilder helloWorldClass =
            CreateCallee(System.Threading.Thread.GetDomain());

        EventInfo info[] = helloWorldClass.GetEvents(BindingFlags.Public
            | BindingFlags.Instance);
        Console.WriteLine("'HelloWorld' type has following events :");
        for (int i = 0; i < info.length;
 i++) {
            Console.WriteLine(info[i].get_Name());
        }
    } //main

    // Create the callee transient dynamic assembly.
    private static TypeBuilder CreateCallee(AppDomain
 myDomain)
    {
        AssemblyName assemblyName = new AssemblyName();
        assemblyName.set_Name("EmittedAssembly");
        // Create the callee dynamic assembly.
        AssemblyBuilder myAssembly = myDomain.DefineDynamicAssembly(assemblyName
,
            AssemblyBuilderAccess.Run);
        // Create a dynamic module named "CalleeModule" in the
 callee.
        ModuleBuilder myModule = myAssembly.DefineDynamicModule("EmittedModule");
        // Define a public class named "HelloWorld" in the
 assembly.
        TypeBuilder helloWorldClass = myModule.DefineType("HelloWorld"
,
            TypeAttributes.Public);

        MethodBuilder myMethod1 = helloWorldClass.DefineMethod("OnClick"
,
            MethodAttributes.Public, void.class.ToType()
,
            new Type[] { Object.class.ToType()
 });
        ILGenerator methodIL1 = myMethod1.GetILGenerator();
        methodIL1.Emit(OpCodes.Ret);
        MethodBuilder myMethod2 = helloWorldClass.DefineMethod("OnMouseUp"
,
            MethodAttributes.Public, void.class.ToType()
,
            new Type[] { Object.class.ToType()
 });
        ILGenerator methodIL2 = myMethod2.GetILGenerator();
        methodIL2.Emit(OpCodes.Ret);
        // Create the events.
        EventBuilder myEvent1 = helloWorldClass.DefineEvent("Click",
            EventAttributes.None, MyEvent.class.ToType());
        myEvent1.SetRaiseMethod(myMethod1);
        EventBuilder myEvent2 = helloWorldClass.DefineEvent("MouseUp",
            EventAttributes.None, MyEvent.class.ToType());
        myEvent2.SetRaiseMethod(myMethod2);

        helloWorldClass.CreateType();
        return helloWorldClass;
    } //CreateCallee
}//MyApplication
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EventAttributes 列挙体」の関連用語

EventAttributes 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventAttributes 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS