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

Объект ResolveNameEventArgs, содержащий данные события.A ResolveNameEventArgs that contains the event data.

Наследование
ResolveNameEventHandler

Примеры

Следующий пример кода присоединяет ResolveNameEventHandler ResolveName к событию указанного IDesignerSerializationManagerобъекта.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.

Применяется к

Дополнительно