Please how this string concatenation taking place?
i am really confuse what is happening why that slash i there and how the double quotes are used
SessionStateItemCollection items = new SessionStateItemCollection();
items["LastName"] = "Wilson";
items["FirstName"] = "Dan";
foreach (string s in items.Keys)
Response.Write("items[\"" + s + "\"] = " + items[s].ToString() + "<br />");
//here i am looking for explanation please elaborate me on this please
Response.Write("items[\"" + s + "\"] = " + items[s].ToString() + "<br />");
The slash is escaping the quote. Basically it is going to write the name in quotes inside brackets. For your example the output would be:
The escaping happens for the character directly after the backslash
\. So\"is escaped to". The following"is stopping the string and you are appending thesvariable which in turn is the current item in the foreach loop.Here is a article on escape characters.