csharp-generichandler

C# 泛型委托书写

###

1
2
3
4
5
6
7
8
//先声明泛型委托
public delegate T GetHandler<T>(string propertyName,T t);

//再定义
GetHandler<string> strHandler = new GetHandler<string>((ss, s) => { return ""; });

//再调用
string str = strHandler("Id", "ss");
欢迎关注我的公众号:沉迷Spring
显示 Gitment 评论
0%