Here I would like to explain about C#. language features and variables , every thing that make an unknown C# developer can write the program.
C# Language Features :
C#, also know as C-Sharp, is a programming language introduced by Microsoft. C# contains features similar to Java and C++. It is specially designed to work with
Microsoft's .Net platform.
Microsoft's .Net platform.
C# Compiler :
A Compiler is a special program that processes the statements written in a particular programming language and converts them into machine language. Like everything else in the computer, the compiler also follows the Input-process-Output(I-O-P) cycle. It takes the programming language. These instructions can then be executed by the computer. This process of conversion is called compilation. For each programming language , there is a different compiler available. For example, for compiling a program written in the language , you require a Compiler, For a java program, you require a java compiler. For C# programs, you will use the csc compiler.
You will now learn how to create classes in the C# language.
You will now learn how to create classes in the C# language.
Classes in C# :
Consider the following code example, which defines a Class:
Using System;
public class Hello
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
The preceding class declaration provides a method main() that will display the message " Hello World" pn your screen. The parts of preceding code need to be examined.
The Main() Function:
The first line of code that a c# compiler looks for in the source file Compiled is the Main() function. This function is the entry point of the Application.
The Main() function is ideally used to create objects and invoke member functions.
The Class Keyword :
The Class keyword is used to declare a class. Keywords are reserved words that have a special meaning. Here, the class keyword defines the class Hello. The braces, known as delimeters, are used to indicate the start and end of a class body.
Example :
class Hello
{
........
}
class Hello
{
........
}
C# Variables :
Variables represent storage locations. Every variable has a type that determines the values that can be stored in the variable. C# is a type-safety language and C# compiler guarantees that values stored in variables are always of the appropriate type.
C# Data Types :
C# is a strongly typed language therefore every variable and object have a declared type. Some of the data types and their ranges in C# are explained below as
Data Type | Size in Bytes | Range |
---|---|---|
int | 4 | -2,147,483,648 to 2,147,483,647 |
double | 8 | 5.0X10 to the power of -324 to 1.7X10 to the power of 308 |
bool | 1 | True/False |
char | 2 | 0 to 65535 |