I have the next code:
public byte[] A(int i){//do something}
public byte[] B(string a) { //do something}
public void useAMethod()
{
//Previous code
byte[] array = A(0);
//final code using array
}
public void useBMethod()
{
//Previous code
byte[] array = B("test");
//final code using array
}
Like you can see, i have two methods with same return value but differents params
I would like something like:
public void useAnyMethod([method] methodToUse)
{
//Previous code
byte[] array = methodToUse;
//final code using array
}
To use like:
useAnyMethod(A(0));
useAnyMethod(B("test"));
is it posiible??
Thanks
I take it the
byte[] =is some sort of internal assignment?If so
useAnyMethod doesn’t actually call the method it just accepts the return value of the method which the runtime will call first to get the result.
Alternatively if you are determined to used a delegate