-1

all what i need to know is how to store a code like the below into string variable

if (status == "admin")
{
   Messegebox.Show("Hello");
}

Note that: I have tried @ and \ but the result is still some redlines .

1 Answers1

0

Use '\' to escape double quotes within the string and '\n' to reflect new lines:

{String myCode = "if (status == \"admin\")\n{\n    Messegebox.Show(\"Hello\");\n}";}
Alex Evseenko
  • 122
  • 1
  • 5