
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is @ in front of a string in C#?
It marks the string as a verbatim string literal.
In C#, a verbatim string is created using a special symbol @. @ is known as a verbatim identifier. If a string contains @ as a prefix followed by double quotes, then compiler identifies that string as a verbatim string and compile that string. The main advantage of @ symbol is to tell the string constructor to ignore escape characters and line breaks.
Example
using System; using System.IO; namespace DemoApplication{ class Program{ static void Main(string[] args){ Console.WriteLine("test string
test string"); Console.WriteLine(@"test string
test string"); //Both the below statements are same. string jsonString1 = File.ReadAllText(@"D:\Json.json"); string jsonString2 = File.ReadAllText("D:\Json.json"); Console.ReadLine(); } } }
Output
The output of the above code is as follows.
test string test string test string
test string
- Related Articles
- What does the 'b' character do in front of a string literal in Python?
- Python code to move spaces to the front of string in a single traversal
- Python program to move spaces to front of string in single traversal
- What is Front-end Testing? Tools & Frameworks
- What is a string literal in C++?
- What is a sub string in Java?
- What is the difference between a string and a byte string in Python?
- What UPA, NDA and Third Front in Indian Politics?
- What is the name of:(a) the curved, transparent front surface of the eye?(b) the light-sensitive layer in the eye?
- What is the difference between a String object and a String literal in Java?
- What is a null-terminated string in C/C++?
- What is the maximum length of string in Python?
- What is the meaning of immutable in term of String in java?
- Which property of light makes a pencil cast a shadow when it is held in front of a light source?
- What is a constructor to create String object in JavaScript?

Advertisements