Top "Nullable" questions

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

C# elegant way to check if a property's property is null

In C#, say that you want to pull a value off of PropertyC in this example and ObjectA, PropertyA and …

c# nullreferenceexception nullable null-conditional-operator
Checkbox for nullable boolean

My model has a boolean that has to be nullable public bool? Foo { get; set; } so in my Razor cshtml …

asp.net-mvc-3 razor nullable
How do I use DateTime.TryParse with a Nullable<DateTime>?

I want to use the DateTime.TryParse method to get the datetime value of a string into a Nullable. But …

c# datetime nullable
Which is preferred: Nullable<T>.HasValue or Nullable<T> != null?

I always used Nullable<>.HasValue because I liked the semantics. However, recently I was working on someone else's …

c# .net null nullable
Why can't I check if a 'DateTime' is 'Nothing'?

In VB.NET, is there a way to set a DateTime variable to "not set"? And why is it possible …

vb.net datetime null nullable nothing
How to check if an object is nullable?

How do I check if a given object is nullable in other words how to implement the following method... bool …

c# .net nullable
How to return when an optional is empty?

I love that optionals are in the Java standard library now. But there is one basic problem I keep running …

java nullable optional
Nullable return types in PHP7

PHP 7 introduces return type declarations. Which means I can now indicate the return value is a certain class, interface, array, …

php nullable return-type type-hinting php-7
Nullable object must have a value?

On the line: bool travel = fill.travel.Value; I am getting the following error: Nullable object must have a value …

c# .net linq-to-sql exception-handling nullable
Nullable types and the ternary operator: why is `? 10 : null` forbidden?

I just came across a weird error: private bool GetBoolValue() { //Do some logic and return true or false } Then, in …

c# .net nullable conditional-operator