开发者

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

开发者 https://www.devze.com 2023-03-04 09:10 出处:网络
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

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

精彩评论

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