c# - Local constant initialised to null reference -


i have read c# allows local constants initialised null reference, example:

const string mystring = null; 

is there point in doing however? possible uses have?

my guess because null is valid value can assigned reference types , nullable values types. can't see reason forbid this.

there might far off edge cases can useful, example multi targeting , conditional compilation. ie want define constant 1 platform define null due missing functionality.

ex, of possible usefull usage:

#if (silvelight)     public const string defaultname = null; #else     public const string defaultname = "win7"; #endif  

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -