Class TypedMessageCallback<T>
Event callback for received messages and events.
Namespace: TehGM.Wolfringo.Utilities.Internal
Assembly: Wolfringo.Core.dll
Syntax
public class TypedMessageCallback<T> : IMessageCallback, IEquatable<TypedMessageCallback<T>> where T : IWolfMessage
Type Parameters
Name | Description |
---|---|
T |
Remarks
This interface is designed to allow invoking callback conditionally. If TryInvoke(IWolfMessage) returns false, it doesn't meant invoking failed - it means that callback determined it should not invoke for the provided message.
This callback will only invoke if message is of type T
.
Constructors
| Improve this Doc View SourceTypedMessageCallback(Action<T>)
Creates callback instance.
Declaration
public TypedMessageCallback(Action<T> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | callback | Method to invoke when this callback invokes. |
Properties
| Improve this Doc View SourceCallbackInfo
Method to invoke.
Declaration
public MethodInfo CallbackInfo { get; }
Property Value
Type | Description |
---|---|
MethodInfo |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceEquals(TypedMessageCallback<T>)
Declaration
public bool Equals(TypedMessageCallback<T> other)
Parameters
Type | Name | Description |
---|---|---|
TypedMessageCallback<T> | other |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceTryInvoke(IWolfMessage)
Attempts to invoke the callback.
Declaration
public virtual bool TryInvoke(IWolfMessage message)
Parameters
Type | Name | Description |
---|---|---|
IWolfMessage | message | Message to attempt invoking the callback for. |
Returns
Type | Description |
---|---|
Boolean | True if callback was invoked; otherwise false. |
Remarks
Callback will only invoke if message
is of type T
.