Can someone give me a list, or point me to where I can find a list of C# data types that can be a nullable type?
For example:
- I know that
Nullable<int>
is ok - I know that
Nullable<byte[]>
is not.
I'd like to know which types are nullable and which are not. BTW, I know I can test for this at runtime. However, this is for a code generator we're writing, so I don't have an actual type. I just know that a column is string
or int32
(etc).
Nullable<byte[]>
is not ok because arrays are reference types (even if the type they contain is a value type). Note that this means you can dobyte[] b = null
. – Numbersnumbfish