I have the following interface that returns the generic parameter of type T using a callback...
public interface IDoWork<T>
{
T DoWork();
}
however I also have the following interface as well, but it won't invoke a callback since it returns void.
public interface IDoWork
{
void DoWork();
}
Can I combine these two interfaces and use runtime logic to determine the difference? How can I do that?
return type is a part of method signature, so T DoWork() and void DoWork() are different, and void is not a type and it is not a null
. It is an indication there is nothing in evaluation stack on return from method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.