Results 1 to 4 of 4

Thread: Verbatim string literal in C#

  1. #1
    Join Date
    Sep 2009
    Posts
    177

    Verbatim string literal in C#

    I have a question on Verbatim String in C#. I have just started to use C #. Although I have learnt C, C++ from my college, but C# I am learning on my own. I am finding this quite difficult. I am on the String Literals topic and I am not able to uderstand this topic. And also can anyone explain to me what is a Verbatim string literals in C#. Thank you in advance.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Verbatim string literal in C#

    There are two types of String Literals in C sharp they are:
    1. String Literals.
    2. Verbatim String Literals.
    While we declare a String variable there are a few characters which we are not allowed to use. Some of these are ', ", \.
    But a solution to this is to use the Verbatim String. A Verbatim string maes use of the @ symbol.
    eg.
    C:\Program Files\
    The above path can be specified as:
    Code:
    string rooot = @"C:\Program Files\"

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Verbatim string literal in C#

    I am also learning C Sharp and this is my first programming language experience. C sharp includes a unique string literal named Verbatim string literal. A string literal which had @ sign in the start is called a Verbatim string literal. This 'at sign' defines that within the following " "(quotation mark) there should be no interpretation of chararcter to be done.
    Last edited by Katty; 16-11-2009 at 11:41 PM.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Verbatim string literal in C#

    I also had similar problem when I started studying C sharp. I was also alot confused with this Verbatim String. In C Sharp a Verbatim String literal includes an @ sign and the string enclosed in "" following the @ sign. Thus, the compiler will not perform any character interpretation on the Verbatim String. Thus allowing the programmer to use those charactrs and symbols which they are not allowed to use. For example, if a programmer wants to print "Good Morning", the programmer can do it in the following manner;
    string S = @"Good Morning";

Similar Threads

  1. SSD support for Verbatim ExpressCard
    By veGANor in forum Hardware Peripherals
    Replies: 4
    Last Post: 14-01-2011, 01:30 AM
  2. How to Manipulate String using PHP String Functions
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 09:07 AM
  3. Best dvd-r brand tdk or verbatim
    By fastrod in forum Hardware Peripherals
    Replies: 3
    Last Post: 08-08-2009, 10:56 AM
  4. Verbatim Mac OS X 8GB USB drive
    By jacky in forum Portable Devices
    Replies: 2
    Last Post: 07-01-2009, 10:57 AM
  5. Verbatim Rolls Out Speaker Keyboard
    By AvO in forum Portable Devices
    Replies: 2
    Last Post: 13-12-2008, 04:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,649,203.17336 seconds with 16 queries