Csharp/C Sharp/Language Basics/At
Demonstrate an @ identier
// Demonstrate an @ identier.
using System;
public class IdTest {
static void Main() {
int @if; // use if as an identifier
for(@if = 0; @if < 10; @if++)
Console.WriteLine("@if is " + @if);
}
}
The @ prefix turns off the processing of escape characters.
using System;
using System.Text;
class StringApp {
static void Main(string[] args) {
string finalString = @"\n\tString file: "C:\MyApp\Strings"";
Console.WriteLine(finalString);
}
}
White space is preserved with verbatim strings.
using System;
using System.Text;
class StringApp {
static void Main(string[] args) {
string myLongString = @"This is a very
very
very
long string";
Console.WriteLine(myLongString);
}
}