Results 1 to 6 of 6

Thread: Data Types in C sharp language

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    Data Types in C sharp language

    Hello Friends,

    I just completed the advanced java programming. And going to start the C sharp language. I wanted to know about the data types in C sharp language. Are data types of java and C sharp are identical? I only know that C sharp is ".net" language.
    Please let know what are the different data types are available in C sharp language.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Data Types in C sharp language

    Hi,

    Following are some data types of C sharp language with their range:
    • sbyte(-128 to 127)
    • byte(0 to 255)
    • bool(0 to 1)
    • int(-2,147,483,647 to 2,147,483,647)
    • float( –1.5x10-45 to 3.4x1038)
    • decimal(1.0x10-28 to 7.9x1028)

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

    Re: Data Types in C sharp language

    The data types of c sharp and java are nearly same but there some advanced data types in the C sharp language. Please review carefully below C# data types with their examples:
    1).short: E.g 5,6,7
    2).long: E.g 5,6,7,-5,-6,-7
    3).double: E.g 5.8,6.9,7.1
    4).char: E.g 'D','J','K'
    5).String: E.g "hello","welcome","bye"

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

    Re: Data Types in C sharp language

    Hello,

    Following program will depict the different C sharp data types with their syntax:
    using System.Console;
    class DataTypesDemo
    {
    public void Main(string arg[])
    {
    int x=8,// integer data type
    char d,h; // character data type
    double y, u; // double data type
    y= x*x
    Console.WriteLine("multiplication of two integer= ");
    Console.WriteLine(y);
    }
    }

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

    Re: Data Types in C sharp language

    Data Types of variable describes type of data a variable only can hold . C# is a strongly typed programming language. In c # every object as well as variable must have data type. There are basically three categories of the data types available in the C# i.e
    1. Pointer Types
    2. Reference Types
    3. Value Types
    In C# it is valid to convert the variable of one data type into another data type. In C# this conversion process is known as "Boxing" and "Unboxing" .

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

    Re: Data Types in C sharp language

    The declaration syntax of data types in the all programming language is similar. The c sharp language comprises data types such as : int, bool, double, float, char, string, long, decimal, short, ushort, sbyte, byte etc. Below are some examples:
    *. Integer:
    int ctt;// declaration
    ctt = 150;//Initialization

    *. Double:
    int ctt;// declaration
    ctt = 15.60;//Initialization

Similar Threads

  1. How is C# Sharp a type safe language ?
    By Satchel in forum Software Development
    Replies: 7
    Last Post: 03-01-2011, 10:13 PM
  2. Different types of data bus in computer
    By CAILYN in forum Hardware Peripherals
    Replies: 5
    Last Post: 29-01-2010, 06:39 AM
  3. What are the the different Data Types available in Oracle?
    By Truster in forum Software Development
    Replies: 5
    Last Post: 09-01-2010, 02:58 PM
  4. Programming language C Sharp and its characteristics
    By Jesus-Ernesto in forum Software Development
    Replies: 4
    Last Post: 28-11-2009, 01:06 AM
  5. Data Types in MySQL
    By Jacek01 in forum Software Development
    Replies: 2
    Last Post: 10-02-2009, 03:08 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,713,278,071.47933 seconds with 17 queries