Top "Nullable" questions

The nullable tag is for issues relating to nullable members or types.

Correct way to check if a type is Nullable

In order to check if a Type ( propertyType ) is nullable, I'm using: bool isNullable = "Nullable`1".Equals(propertyType.Name) Is there …

c# generics nullable
How can I convert decimal? to decimal

may be it is a simple question but I'm try all of conversion method! and it still has error! would …

c# .net decimal type-conversion nullable
.NET - Convert Generic Collection to DataTable

I am trying to convert a generic collection (List) to a DataTable. I found the following code to help me …

c# generics collections datatable nullable
How does comparison operator works with null int?

I am starting to learn nullable types and ran into following behavior. While trying nullable int, i see comparison operator …

c# nullable
Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and <null>

Why does this not compile? int? number = true ? 5 : null; Type of conditional expression cannot be determined because there is no …

c# nullable
What is 'long?' data type?

I am going over some code written by another developer and am not sure what long? means: protected string AccountToLogin(…

c# nullable
Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib]]

Type t = typeof(int?); //will get this dynamically object val = 5; //will get this dynamically object nVal = Convert.ChangeType(val, t);//…

c# .net casting type-conversion nullable
What is the default value of the nullable type "int?" (including question mark)?

In C#, what is the default value of a class instance variable of type int?? For example, in the following …

c# integer nullable
How to use nonnull and nullable Objective-C keywords in block-based API method

Consider the following method - (void)methodWithArg:(NSString *)arg1 andArg:(NSString *)arg2 completionHandler:(void (^)(NSArray *results, NSError *error))completionHandler; With …

objective-c xcode block nullable
What does "DateTime?" mean in C#?

I am reading a .NET book, and in one of the code examples there is a class definition with this …

c# .net datetime syntax nullable