Why are string constants null on postback?

  • Thread starter Thread starter Brad Wood
  • Start date Start date
B

Brad Wood

I have a global struct with some string constants in it like:

public struct SOME_CONSTANTS
{
public const string DUDE = "killer";
public const string SWEET = "righteous";
}

This is accessible fine when the page is first called, but on postack,
this struct shows null. ???
 
Are you saying you're looking at the struct member in the debugger and it
shows null, or is it actually null when you try to do something with it?

The former is a known problem with the VS.NET debugger. It shows null for
static/const struct members under some circumstances.

If that's not the case then you definitely have a problem =)
 

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