Represents a delegate, which is a data structure that refers to a static method or to a class instance && an instance method of that class.
Public Aliases | |
| using | function_t |
| Represents function type. | |
| using | function_collection |
| Represents the function collection type. | |
Public Constructors | |
| delegate ()=default | |
| Initializes an empty delegate. | |
| delegate (const function_t &function) noexcept | |
| Initializes a delegate that invokes the specified instance method. | |
| template<class object1_t, class object2_t> | |
| delegate (const object1_t &object, result_t(object2_t::*method)() const) noexcept | |
| Initializes a delegate that invokes the specified instance method on the specified class instance. | |
| template<class object1_t, class object2_t> | |
| delegate (const object1_t &object, result_t(object2_t::*method)()) noexcept | |
| Initializes a delegate that invokes the specified instance method on the specified class instance. | |
Public Properties | |
| const function_collection & | functions () const |
| Gets the delegates array. | |
| bool | is_empty () const noexcept |
| Return if the delegate is empty. | |
| size_t | size () const noexcept |
| Return the size of invocation list. | |
Public Methods | |
| void | clear () |
| Clear delegates array. | |
| async_result | begin_invoke () |
| Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on. | |
| async_result | begin_invoke (xtd::async_callback async_callback) |
| Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on. | |
| async_result | begin_invoke (xtd::async_callback async_callback, const xtd::any_object &async_state) |
| Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on. | |
| result_t | end_invoke (async_result async) |
| Retrieves the return value of the asynchronous operation represented by the async_result_invoke passed. | |
| result_t | invoke () const |
| invokes the method represented by the current delegate. | |
| bool | equals (const object &obj) const noexcept override |
| Determines whether this instance and another specified delegateType object have the same value. | |
| bool | equals (const delegate &other) const noexcept override |
| Determines whether this instance and another specified delegateType object have the same value. | |
Operators | |
| result_t | operator() () const |
| invokes the method represented by the current delegate. | |
| delegate & | operator= (const function_t &function) noexcept |
Public Static Methods | |
| static delegate | combine (const array< delegate > &delegates) noexcept |
| Concatenates the invocation lists of an array of delegates. | |
| static delegate | combine (const delegate &a, const delegate &b) noexcept |
| Concatenates the invocation lists of two delegates. | |
| static delegate | remove (const delegate &source, const delegate &value) noexcept |
| removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate. | |
| static delegate | remove_all (const delegate &source, const delegate &value) noexcept |
| removes all occurrences of the invocation list of a delegate from the invocation list of another delegate. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual xtd::size | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual xtd::string | to_string () const noexcept |
| Returns a xtd::string that represents the current object. | |
| virtual bool | equals (const delegate< result_t() > &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| using xtd::delegate< result_t()>::function_t |
Represents function type.
| using xtd::delegate< result_t()>::function_collection |
Represents the function collection type.
|
default |
Initializes an empty delegate.
|
inlinenoexcept |
Initializes a delegate that invokes the specified instance method.
| function | the method instance. |
|
inlinenoexcept |
Initializes a delegate that invokes the specified instance method on the specified class instance.
| object | the class instance. |
| function | the method instance. |
|
inlinenoexcept |
Initializes a delegate that invokes the specified instance method on the specified class instance.
| object | the class instance. |
| function | the method instance. |
|
inline |
Gets the delegates array.
|
inlinenoexcept |
Return if the delegate is empty.
true if delegate is empty; otherwise false.
|
inlinenoexcept |
Return the size of invocation list.
|
inline |
Clear delegates array.
| async_result xtd::delegate< result_t()>::begin_invoke | ( | ) |
Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on.
| async_result xtd::delegate< result_t()>::begin_invoke | ( | xtd::async_callback | async_callback | ) |
Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on.
| async_callback | The asynchronous callback that will be called at the end of the invocation. |
| async_result xtd::delegate< result_t()>::begin_invoke | ( | xtd::async_callback | async_callback, |
| const xtd::any_object & | async_state ) |
Executes the method represented by the current delegate asynchronously on the thread that the control's underlying handle was created on.
| async_callback | The asynchronous callback that will be called at the end of the invocation. |
| async_state | The asynchronous state associated with the invocation. |
| result_t xtd::delegate< result_t()>::end_invoke | ( | async_result | async | ) |
Retrieves the return value of the asynchronous operation represented by the async_result_invoke passed.
| async | The async_result_invoke that represents a specific invoke asynchronous operation, returned when calling begin_invoke. |
|
inline |
invokes the method represented by the current delegate.
| arguments | The parameter list. |
|
inlineoverridevirtualnoexcept |
Determines whether this instance and another specified delegateType object have the same value.
| obj | The delegateType to compare. |
true if the value of this instance is the same as the value of value; otherwise, false. Reimplemented from xtd::object.
|
inlineoverridenoexcept |
Determines whether this instance and another specified delegateType object have the same value.
| other | The delegateType to compare. |
true if the value of this instance is the same as the value of value; otherwise, false.
|
inlinestaticnoexcept |
Concatenates the invocation lists of an array of delegates.
| delegates | The array of delegates to combine. |
|
inlinestaticnoexcept |
Concatenates the invocation lists of two delegates.
| a | The delegate whose invocation list comes first. |
| b | The delegate whose invocation list comes second. |
|
inlinestaticnoexcept |
removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate.
| source | The delegate from which to remove the invocation list of value. |
| value | The delegate that supplies the invocation list to remove from the invocation list of source. |
|
inlinestaticnoexcept |
removes all occurrences of the invocation list of a delegate from the invocation list of another delegate.
| source | The delegate from which to remove the invocation list of value. |
| value | The delegate that supplies the invocation list to remove from the invocation list of source. |
|
inline |
invokes the method represented by the current delegate.
| arguments | The parameter list. |