C#
  Home arrow C# arrow C# Simplified
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

C# Simplified
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 10
    2005-03-01

    Table of Contents:
  • C# Simplified
  • Different Types of Data Types
  • Value Types and Reference Types
  • Boxing and Unboxing
  • Classes

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    C# Simplified


    (Page 1 of 5 )

    Want to learn C# but don't know where to begin? Look no further. This article, the first in a series of articles covering the language, will provide you with a good starting point.

    Support file for this article is available here.


    In this article, you will learn about:

    • Data Types, Variables and Operators

    • Value Types and Reference Types

    • Classes

    Data Types, Variables and Operators

    Data Types and Variables are the core of the C# programming language. They represent how to express numbers, characters, strings and other values in real code. For example, if you want to add two numbers, such as 100 and 200, you must write a code as shown below:

    Listing 1.1

    int X = 100;
    int Y = 200;
    int Z = x+y;
    Console.WriteLine(Z);

    The above code is not a complete listing but it shows the way you have to declare values.

    In listing 1.1, the term int represents the built-in data type called Integer. The int is an alias for the Integer data type. Like Integer, there are lots of other data types which you can use for your programming tasks.

    You will also notice three characters named X, Y and Z in the above code. They are known as variables. X, Y and Z are the names given to the variables. Variables are used to store data in the memory. Without variables you cannot store data and perform manipulations. They are the containers for the real data. 100 and 200 are the values given for the respective variables. The end result is stored in another variable called Z.

    Each data type has a fixed range beyond which you cannot store values. If you attempt to store a big value for an Integer data type, the program will emit errors. Consider a scenario where you are storing a value of 500 using a Byte data type. The program will not show any errors during the compilation stage since the basic logic is correct. Instead, there will be runtime errors because you are storing too high a value for the byte data type. It will only hold values up to 255. These errors are called as Exceptions. You will learn more about exceptions in a later article.

    You must always use the data type best suited to your programming needs. For example, if you are writing code for developing a calculator, it’s better to use data types which will accept large values. This will help you to avoid costly runtime errors.

    More C# Articles
    More By Anand Narayanaswamy


       · This is a good beginning. It is simple enogh for a newbie. Perhaps it should be...
     

    C# ARTICLES

    - Color Transformation in C# GDI+ Programming
    - Exceptions in C#
    - Overriding versus Overloading
    - Value Types and Reference Types
    - Defining Member and Type Visibility
    - Managing Files in C#
    - Working with Windows Registry in C#
    - Lossless Image Resizing in C#
    - Lossless Image Converting in C#
    - Creating an RSS Feed with ASP.Net Written in...
    - Polymorphism in C#
    - Inheritance in C#
    - C# Events Explained
    - C# Delegates Explained
    - C# StreamReader and StreamWriter Explained





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway