This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public interface I | |
{ | |
void Do(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1、允许泛型参数类型为void,但其前提是该参数必须被标记为out | |
public Task<out T> | |
{ | |
//... | |
} | |
Task<void> task;//合法 | |
IEnumerable<void> data;//合法 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Test | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var list = new MyClass<string>(); |