开发者

Is there any way to restrict a generic type parameter to an anonymous type?

Is there any way to restrict a generic type parameter开发者_如何学Go to an anonymous type in C# 4.0? Or is where T: class the closest I will come ?


No, there are no such constraints in C#. You could add an execution-time check to validate that the type has the characteristics of an anonymous type though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜