Well, it sounds like you may be trying to detect the difference between a value type and a reference type. You can find that out using Type.IsValueType
... but be aware that value types can easily have properties too. (Think about DateTime
for example.) Also, some types which you may want to regard as "not objects" are reference types - string
being a prime example.
Another option would be to use Type.IsPrimitive
- is that what you're looking for? If so, you should be aware that decimal
, DateTime
and string
are not primitive types.
If you can describe exactly what makes a type an "object" in your way of thinking (or rather, in whatever way makes a semantic difference in what you're trying to do with your type). I suspect you don't currently have a very clear set of criteria - coming up with those criteria may well clarify other aspects of your current task, too.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…