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:
Nullable<int>
is okNullable<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).
What Does C Programming Language (C) Mean? C is a high-level and general-purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System in the early 1970s.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
C is one of the high-level programming languages developed by Dennis Ritchie. C was originally developed for UNIX operating system to beat the issues of previous languages such as B, BCPL, etc. The UNIX operating system development started in the year 1969, and its code was rewritten in C in the year 1972.
The C programming language is a low-level (close to the computer) computer programming language that was developed to do system programming for the operating system UNIX and is an imperative programming language. C was developed in the early 1970s by Ken Thompson and Dennis Ritchie at Bell Labs.
All value types (except Nullable<T>
itself) can be used in nullable types – i.e. all types that derive from System.ValueType
(that also includes enum
s!).
The reason for this is that Nullable
is declared something like this:
struct Nullable<T> where T : struct, new() { … }
A type is said to be nullable if it can be assigned a value or can be assigned null, which means the type has no value whatsoever. Consequently, a nullable type can express a value, or that no value exists. For example, a reference type such as String is nullable, whereas a value type such as Int32 is not. A value type cannot be nullable because it has enough capacity to express only the values appropriate for that type; it does not have the additional capacity required to express a value of null.
The Nullable structure supports using only a value type as a nullable type because reference types are nullable by design.
The Nullable class provides complementary support for the Nullable structure. The Nullable class supports obtaining the underlying type of a nullable type, and comparison and equality operations on pairs of nullable types whose underlying value type does not support generic comparison and equality operations.
From Help Docs http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx
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