ResolveNameEventHandler 代理人

定義

シリアル化マネージャーの ResolveName イベントを処理するメソッドを表します。Represents the method that handles the ResolveName event of a serialization manager.

public delegate void ResolveNameEventHandler(System::Object ^ sender, ResolveNameEventArgs ^ e);
public delegate void ResolveNameEventHandler(object sender, ResolveNameEventArgs e);
type ResolveNameEventHandler = delegate of obj * ResolveNameEventArgs -> unit
Public Delegate Sub ResolveNameEventHandler(sender As Object, e As ResolveNameEventArgs)

パラメーター

sender
Object

イベントのソース。The source of the event.

e
ResolveNameEventArgs

イベント データを格納している ResolveNameEventArgsA ResolveNameEventArgs that contains the event data.

継承
ResolveNameEventHandler

次のコード例では、指定した IDesignerSerializationManagerResolveName イベントに ResolveNameEventHandler をアタッチします。The following code example attaches a ResolveNameEventHandler to the ResolveName event of a specified IDesignerSerializationManager.

public:
   void LinkResolveNameEvent( IDesignerSerializationManager^ serializationManager )
   {
      // Registers an event handler for the ResolveName event.
      serializationManager->ResolveName +=
         gcnew ResolveNameEventHandler( this, &Form1::OnResolveName );
   }

private:
   void OnResolveName( Object^ sender, ResolveNameEventArgs^ e )
   {
      // Displays ResolveName event information on the console.
      Console::WriteLine( "Name of the name to resolve: " + e->Name );
      Console::WriteLine( "ToString output of the Object that no name was resolved for: " +
         e->Value );
   }
public void LinkResolveNameEvent(
        IDesignerSerializationManager serializationManager)
{
    // Registers an event handler for the ResolveName event.
    serializationManager.ResolveName += 
        new ResolveNameEventHandler(this.OnResolveName);
}

private void OnResolveName(object sender, ResolveNameEventArgs e)
{                        
    // Displays ResolveName event information on the console. 
    Console.WriteLine("Name of the name to resolve: "+e.Name);
    Console.WriteLine("ToString output of the object that no name was resolved for: "+e.Value.ToString());            
}
Public Sub LinkResolveNameEvent(ByVal serializationManager As IDesignerSerializationManager)
    ' Registers an event handler for the resolve name event.
    AddHandler serializationManager.ResolveName, AddressOf Me.OnResolveName
End Sub

Private Sub OnResolveName(ByVal sender As Object, ByVal e As ResolveNameEventArgs)
    ' Displays ResolveName event information on the Console.
    Console.WriteLine(("Name of the name to resolve: " + e.Name))
    Console.WriteLine(("ToString output of the object that no name was resolved for: " + e.Value.ToString()))
End Sub

注釈

このデリゲートは、シリアル化および逆シリアル化の際にオブジェクト名を解決するために IDesignerSerializationManager によって使用されます。This delegate is used by the IDesignerSerializationManager to resolve object names during serialization and deserialization.

ResolveNameEventHandler デリゲートを作成する場合は、イベントを処理するメソッドを指定します。When you create a ResolveNameEventHandler delegate, you identify the method that will handle the event. イベント ハンドラーにイベントを関連付けるには、イベントにデリゲートのインスタンスを追加します。To associate the event with your event handler, add an instance of the delegate to the event. イベント ハンドラーは、デリゲートを削除しない限り、イベントが発生するたびに呼び出されます。The event handler is called whenever the event occurs, unless you remove the delegate. イベントハンドラーデリゲートの詳細については、「イベントの処理と発生」を参照してください。For more information about event-handler delegates, see Handling and Raising Events.

拡張メソッド

GetMethodInfo(Delegate)

指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。Gets an object that represents the method represented by the specified delegate.

適用対象

こちらもご覧ください