Results 1 to 4 of 4

Thread: Define Types of Literals and Specify Literals in C#

  1. #1
    Join Date
    Nov 2009
    Posts
    63

    Define Types of Literals and Specify Literals in C#

    I want to know what do you mean by Literals in C-Sharp. For what are they used in C-Sharp? How can we specify Literal type in C-Sharp? I am a new C-Sharp leaner. I am not good at software programming that is why I am finding C-Sharp a bit difficult to understand. Please help me with my queries. I am confused about this concept.

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

    Re: Define Types of Literals and Specify Literals in C#

    I too had hard time learning C#. I would first advise you to learn Java and then start with C#. This will help you to learn C#. In simple terms a representation of a source code value is called a Literal in C# programming language. There are these different literals available in C#: integer-literal, string-literal, boolean-literal, null-literal, character-literal and real-literal.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Define Types of Literals and Specify Literals in C#

    The compiler gives a type to the literal value in C-sharp. At the end of a numeric value you can append a letter to specify the way a numeric literal in C-sharp is to be typed. The float value 3.33 to be treated as a float value we will need to append either F or f at the end of the number. Hence the value will be as 3.33F or 3.33f. Thus, the compiler can understand that it is a float value.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Define Types of Literals and Specify Literals in C#

    The compiler in C Sharp need to be made aware of the literal must be behaved as a number type in C Sharp. Thus the way of doing it that at the end of the literal we need to add the number type suffix. For double value 1, it will be 1d and for float value 1, it will be 1f. Thus, the compiler now is aware the when the value 1 is float and when it is double.

Similar Threads

  1. How to Define Namespaces in PHP?
    By SKREECH in forum Software Development
    Replies: 5
    Last Post: 21-02-2010, 02:00 AM
  2. How to define Union?
    By seema_thk in forum Software Development
    Replies: 5
    Last Post: 15-12-2009, 02:07 PM
  3. Define the term- CLR for .NET
    By Jesus2 in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 09:10 PM
  4. Different types Types CCFL's
    By Zipp in forum Overclocking & Computer Modification
    Replies: 3
    Last Post: 29-10-2009, 09:11 AM
  5. Equivalent of #define in C#
    By Luis234 in forum Software Development
    Replies: 6
    Last Post: 20-04-2009, 11:56 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,718,002,706.01289 seconds with 16 queries