My understanding is nothing will happen.
For instance this code:
foreach (var some in (from u in possiblyNullCollection ) )
{
//
}
Should be guarded as:
if ( possiblyNullCollection != null )
{
foreach (var some in (from u in possiblyNullCollection ) )
{
//
}
}
Or is it safe to query a null collection?
A null collection will throw an exception if you query it with LINQ. You need to check for null.
Empty collections are fine however.
Something to keep in mind is that it’s generally considered bad practice for collections to be null. Similar to having null items in a collection, it can cause a lot of bugs.