I have the following code:
public class iSito
{
public const string myVar = "5262";
public iSito()
{
}
}
Now, if from any context (in my case, a .ascx.cs) I try to use iSito.myVar, I can’t get any value.
Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Is the iSito class in another DLL / assembly ? If so, have you rebuild the DLL and have you rebuild the application that consumes the DLL ?
A const value is written as a literal in the IL when you compile the client application. If you change the const, you’ll have to rebuild the client app.
What happens if you change the const to be readonly ? (Just for testing purposes).