Is it possible to register the same operation twice with different parameter types
When I create an app using the mobile SDK, is it possible to define the same operation twice, but with different parameter types? For instance:
operationRegistry.VoidOperation<int>("my-operation").RegisterExecute(HandleMyOp, this);
operationRegistry.VoidOperation<string>("my-operation").RegisterExecute(HandleMyOp, this);
private Task HandleMyOp(int value) { ... }
private Task HandleMyOp(string value) { ... }
Or would I have to register as object, and handle different cases manually?
operationRegistry.VoidOperation<object>("my-operation").RegisterExecute(HandleMyOp, this);
private Task HandleMyOp(object value)
{
if (value is int) { ... }
else if (value is string { ... }
}
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
0 kommentarer