The following code produces no errors when executed:
using ((IDisposable)null) {
Console.WriteLine("A");
}
Console.WriteLine("B");
Is a null value to using
'allowed'? If so, where is it documented?
Most C# code I've seen will create a "dummy/NOP" IDisposable object - is there a particular need for a non-null Disposable object? Was there ever?
If/since null is allowed, it allows placing a null guard inside the using statement as opposed to before or around.
The C# Reference on Using does not mention null values.