does C# has function like perl/php
print <<EOF;
Somthing $a
Line 2
EOF
print multi-line ?
Printable View
does C# has function like perl/php
print <<EOF;
Somthing $a
Line 2
EOF
print multi-line ?
Given that many of us will never have used perl or php, you're limiting who can answer by basically providing code in one of those languages and asking whether C# can do the same. I don't know what that code does exactly so I don't know if C# can do it. Perhaps if you were to describe what it is that you're trying to do.
Console.WriteLine();
If you wrap your string in double quotes and prepend it with the @ symbol, it can span multiple lines, which is similar to the perl construct you are describing.
To place a variable in the string, you place {0}, {1}, {2} where you want the variable to appear, and then add your variables after the constant string:Code:Console.WriteLine(
@"hello
world
line 3"
);
Code:Console.WriteLine("{0} {2} {1}", "hello", 3, "world");