Delegate Construtores
Definição
Inicializa um novo delegado.Initializes a new delegate.
Sobrecargas
| Delegate(Object, String) |
Inicializa um delegado que invoca o método de instância especificado na instância de classe especificada.Initializes a delegate that invokes the specified instance method on the specified class instance. |
| Delegate(Type, String) |
Inicializa um delegado que invoca o método estático especificado da classe especificada.Initializes a delegate that invokes the specified static method from the specified class. |
Delegate(Object, String)
Inicializa um delegado que invoca o método de instância especificado na instância de classe especificada.Initializes a delegate that invokes the specified instance method on the specified class instance.
protected:
Delegate(System::Object ^ target, System::String ^ method);
protected Delegate (object target, string method);
new Delegate : obj * string -> Delegate
Protected Sub New (target As Object, method As String)
Parâmetros
- target
- Object
A instância da classe na qual o delegado invoca method.The class instance on which the delegate invokes method.
- method
- String
O nome do método de instância que o delegado representa.The name of the instance method that the delegate represents.
Exceções
Ocorreu um erro de associação ao método de destino.There was an error binding to the target method.
Comentários
Este construtor não pode ser usado no código do aplicativo.This constructor cannot be used in application code. Para criar um delegado especificando o nome de um método de instância, use uma sobrecarga do CreateDelegate método que especifica um nome de método e um objeto de destino.To create a delegate by specifying the name of an instance method, use an overload of the CreateDelegate method that specifies a method name and a target object. Por exemplo, a CreateDelegate(Type, Object, String) sobrecarga do método cria um delegado para um método de instância com um nome especificado.For example, the CreateDelegate(Type, Object, String) method overload creates a delegate for an instance method with a specified name.
Esse construtor cria delegados apenas para métodos de instância.This constructor creates delegates for instance methods only. Método de instância é um método associado a uma instância de uma classe; método estático é um método associado à própria classe.An instance method is a method that is associated with an instance of a class; a static method is a method that is associated with the class itself.
Confira também
Aplica-se a
Delegate(Type, String)
Inicializa um delegado que invoca o método estático especificado da classe especificada.Initializes a delegate that invokes the specified static method from the specified class.
protected:
Delegate(Type ^ target, System::String ^ method);
protected Delegate (Type target, string method);
new Delegate : Type * string -> Delegate
Protected Sub New (target As Type, method As String)
Parâmetros
- target
- Type
O Type que representa a classe que define method.The Type representing the class that defines method.
- method
- String
O nome do método estático que o delegado representa.The name of the static method that the delegate represents.
Exceções
target não é um RuntimeType.target is not a RuntimeType. Consulte Runtime Types in Reflection (Tipos de tempo de execução na reflexão).See Runtime Types in Reflection.
- ou --or-
target representa um tipo genérico aberto.target represents an open generic type.
Comentários
Este construtor não pode ser usado no código do aplicativo.This constructor cannot be used in application code. Para criar um delegado especificando o nome de um método estático, use uma sobrecarga do CreateDelegate método que especifica um nome de método, mas não especifica um objeto de destino.To create a delegate by specifying the name of a static method, use an overload of the CreateDelegate method that specifies a method name but does not specify a target object. Por exemplo, a CreateDelegate(Type, Type, String) sobrecarga do método cria um delegado estático para um método com um nome especificado.For example, the CreateDelegate(Type, Type, String) method overload creates a static delegate for a method with a specified name.
Esse construtor cria delegados somente para métodos estáticos.This constructor creates delegates for static methods only. Método de instância é um método associado a uma instância de uma classe; método estático é um método associado à própria classe.An instance method is a method that is associated with an instance of a class; a static method is a method that is associated with the class itself.