I have a class ObjectMapper<T>
. Is there any way in .NET 4.0 to tell if typeof(T)
is dynamic
? I want to be able to determine inside a member method whether the class was initialized as new ObjectMapper<dynamic>()
vs. new ObjectMapper<SomeConcreteClass>()
.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
There is no CLR type called
dynamic
. The C# compiler makes all dynamic values of typeobject
and then calls custom binding code to figure out how to handle them. Ifdynamic
was used, it will show up asObject
.You do this by checking if an instance is of type
IDynamicMetaObjectProvider
or you can check whether the type implementsIDynamicMetaObjectProvider
.