Anonymous Types - Are there any distingushing characteristics?

前端 未结 3 1343
别那么骄傲
别那么骄傲 2020-11-27 04:57

Is there anything to use, to determine if a type is actually a anonymous type? For example an interface, etc?

The goal is to create something like the following...

3条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 05:34

    For the purposes of extension methods there is no way to distinguish an anonymous type. Extension methods work by specifying a method for a compile time nameable type. Anonymous types are un-namable and therefore not visible at compile time. This makes them incompatible with extension methods.

提交回复
热议问题