Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm working on exam in which when the student asked to something like (declare if statement) he will answer in Rich text box.

the question is: I want to search for the input of the student in that box, and therefore, I must declare a string that contains the code (as string) something like that:

string check = "            string stat = "new";
            if (stat == "new")
            {
                Console.WriteLine(stat);
            }
";

However, the problem is that, the escape characters and the other preserved voids such as (if).

Briefly: I want to create string that contains a code.

NOTE: I have tried the @ and putting before escape characters, but it didn't work.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
206 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is called the escape sequence and looks like concatenated with " (or another symbol):

string check = " ... " ...";

Where " means "


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...