How do i check if a Type is a struct? IsClass worked perfectly then my reflection stop behaving as i expected when i change the class to the struct. How do i check if its a struct? -edit- i need to check for class/structs. Nothing else, i cant match longs, ints, etc by accident. DateTime may be ok i am using this to search a Attribute/FieldType inside of the type i am checking
Now long and ints are confused with structs.
acidzombie24
2010-01-17 23:06:14
@acidzombie24: `long` and `int` **are** structs. What confusion? Maybe you mean `IsPrimitive`?
Marc Gravell
2010-01-17 23:07:51
I can write IsPrimitive == false (as a shortcut and i have an alternative to most primitives) and use IsValueType. Thanks :)
acidzombie24
2010-01-17 23:11:11
acidzombie24: note this will depend on what you want to exclude. For example, `decimal` is **NOT** a primitive, even though it looks that way in C#. Hopefully this won't be an issue for your use case...
itowlson
2010-01-17 23:13:50
itowlson: Test are all in place and decimal isnt an issue. There are select types i support and user structs are one but only if it has certain attributes :)
acidzombie24
2010-01-17 23:25:15