C# is a general purpose modern object oriented programming language with multiple paradigms. It was designed for Common Language Infrastructure (CLI) in 2000 by Microsoft for its .NET framework. In other words it contains classes, objects, interfaces and inheritance.
Visual Studio .NET includes enormous enhancements over its predecessor Visual Studio ranging from a completely refurbished Visual Basic.NET(VB.NET) to the introduction of a new language Visual C#.NET.
C#(C-Sharp) is a new language which is derived from C and C++. Some of the features include:
- It is simpler as No Pointers. Unsafe operations are not allowed. No usage of “::” or “->” operators.
- “==“ is used for comparison, while”=” is used for assignments.
- Web Service Support – Turn any component into a web service
- Interoperable, Utilises all the benefits of the CLR. Support for COM.
- Objected Orientated – Supports Data encapsulation, inheritance, polymorphism and interfaces.
- Type Safe – Unsafe typecasts are not allowed. Primitive types are initialised to zeros and objects are initialised to null automatically.
First C# program
Type the following into a text editor (e.g. notepad), and save it with a .cs extension. (e.g. firstprogram.cs);
using System;
namespace MyNamespace
{
class MyCsharpClass
{
static void Main()
{
Console.WriteLine ("This is my first C# Program!");
Console.ReadLine();
}
}
}
You can compile above program by simply running the C# command line compiler(i.e. CSC.Exe)
CSC First.cs
Then you can execute the firstprogram.exe by typing firstprogram at the command prompt
- It is simpler as No Pointers. Unsafe operations are not allowed. No usage of “::” or “->” operators.
- “==“ is used for comparison, while”=” is used for assignments.
- Web Service Support – Turn any component into a web service
- Interoperable, Utilises all the benefits of the CLR. Support for COM.
- Objected Orientated – Supports Data encapsulation, inheritance, polymorphism and interfaces.
- Type Safe – Unsafe typecasts are not allowed. Primitive types are initialised to zeros and objects are initialised to null automatically.
First C# program
Type the following into a text editor (e.g. notepad), and save it with a .cs extension. (e.g. firstprogram.cs);
using System;
namespace MyNamespace
{
class MyCsharpClass
{
static void Main()
{
Console.WriteLine ("This is my first C# Program!");
Console.ReadLine();
}
}
}
You can compile above program by simply running the C# command line compiler(i.e. CSC.Exe)
CSC First.cs
Then you can execute the firstprogram.exe by typing firstprogram at the command prompt
Comments
Post a Comment