I want to have a constant string kURL = "http://www.myurl.com/"; throughout my entire project. What’s the proper way to do this in a Windows Phone 7 app?
Where would I put this code and what should the proper syntax be?
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.
Create a .Common project for things that you may need to access from all of your projects in your solution (like constants, extension methods, utils etc.), in there simply create Constants class with any Constants that you may need.
Like this:
}
Usage would be:
Good luck.
Edit Note: Changed to const as per Gabes suggestion
Edit Note2: Changed to static readonly per lukas suggestion