I was pondering of this while I was writing some helper functions dealing with reflection. Is there anything else besides class
es, struct
s, enum
s and interface
s in C#? If I write a function that checks for class
, struct
, enum
and interface
, would that be the all encompassing function?
I read that delegate
s are classes anyway here and here.
Help me make my idea on this kind of hierarchy perfect:
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;
}
Am I missing something?
There are also arrays and delegates, although those are actually classes.
There are also references (ref
parameters to methods) and generic type parameters in definitions of generic methods or types.
In unsafe code, there are also pointers.
Not sure is this is a direct answer to your question but .NET has 5 types:
class, struct, interface, delegate, and enum
Common Type System
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With