private const string s = "" yields null?

  • Thread starter Thread starter Miha Markic
  • Start date Start date
M

Miha Markic

Hi,

Did anybody notice that the following declaration of a member const

public class Tubo
{
private string const def = "";
}

is alyways null instead of empty string ("")?

Is this a bug or feature or something else?

Thanks,
Miha
miham at spin dot si
 
Duh, it is only the debugger reporting it as null.
It is correctly set to "".

Miha
 
string.Empty is the preferred way to do it but "" will work as well
 
Hi William,

string.Empty won't work for constant declaration.

Miha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top