Create string with @ and no need to escape in CSharp

Description

The following code shows how to create string with @ and no need to escape.

Example


    using System;
  public class UsingStrings
  {/*from   w  w w .  j a va 2s .  c  o  m*/
    static void Main(string[] args)
    {
      string MyString = "Hello World java2s.com";
      Console.WriteLine(MyString);
      string Path = @"c:\Program Files";
      Console.WriteLine(Path);
      string Path2 = "c:\\Program Files";
            Console.WriteLine(Path2);
      string Name = "Joe";
      Console.WriteLine(Name);

    }

  }

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var