I found this piece of code and I’d like to understand why the developer used the string constructor with a char array instead of just a literal constant string:
static string atomLang = new String("lang".ToCharArray());
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.
The only reason I can think of is to avoid getting a reference to the interned instance of the string.
Not that this will have any practical effects on your code (other than marginal performance differences).