naw*_*fal 5 .net c# struct types class
当我写一些处理反射的辅助函数时,我正在思考这个问题.除了classes,structs,enums和interfaces 之外还有其他什么吗?如果我写的检查功能class,struct,enum和interface,会是这样的无所不包的功能?
帮助我完善这种层次结构的想法:
reference type value type
| |
--------------- ----------
| | | |
interface class struct enum
// the all encompassing function - pseudo code:
public static bool IsC#Stuff(this Type type)
{
return type.IsEnum || type.IsStruct || type.IsClass || type.IsInterface;
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?