C# Generics: If T is a return type, can it also be void? How can I combine these interfaces together?

前端 未结 2 1112
粉色の甜心
粉色の甜心 2021-01-03 20:57

I have the following interface that returns the generic parameter of type T using a callback...

public interface IDoWork
{
    T DoWork();
}
         


        
2条回答
  •  自闭症患者
    2021-01-03 21:35

    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.

提交回复
热议问题