ResolveNameEventHandler ResolveNameEventHandler ResolveNameEventHandler ResolveNameEventHandler Delegate

Definizione

Rappresenta il metodo che gestisce l'evento ResolveName di un gestore di serializzazione.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)

Parametri

sender
Object Object Object Object

Origine dell'evento.The source of the event.

e
ResolveNameEventArgs ResolveNameEventArgs ResolveNameEventArgs ResolveNameEventArgs

Oggetto ResolveNameEventArgs che contiene i dati dell'evento.A ResolveNameEventArgs that contains the event data.

Ereditarietà
ResolveNameEventHandlerResolveNameEventHandlerResolveNameEventHandlerResolveNameEventHandler

Esempi

Nell'esempio di codice seguente viene collegato ResolveNameEventHandler un oggetto ResolveName all'evento di un IDesignerSerializationManageroggetto specificato.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

Commenti

Questo delegato viene utilizzato da per IDesignerSerializationManager risolvere i nomi degli oggetti durante la serializzazione e la deserializzazione.This delegate is used by the IDesignerSerializationManager to resolve object names during serialization and deserialization.

Quando si crea un delegato ResolveNameEventHandler, si identifica il metodo che gestirà l'evento.When you create a ResolveNameEventHandler delegate, you identify the method that will handle the event. Per associare l'evento al gestore eventi in uso, aggiungere all'evento un'istanza del delegato.To associate the event with your event handler, add an instance of the delegate to the event. Il gestore eventi viene chiamato ogni volta che si verifica l'evento, a meno che non venga rimosso il delegato.The event handler is called whenever the event occurs, unless you remove the delegate. Per ulteriori informazioni sui delegati del gestore eventi, vedere gestione e generazione di eventi.For more information about event-handler delegates, see Handling and Raising Events.

Metodi di estensione

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

Ottiene un oggetto che rappresenta il metodo rappresentato dal delegato specificato.Gets an object that represents the method represented by the specified delegate.

Si applica a

Vedi anche