C# Language Introduction

C# Language Introduction-:  C# (pronounced “See Sharp”) is a simple, modern, object-oriented, and type-safe programming language. C# has its roots in the C family of languages and will be immediately familiar to C, C++, and Java programmers.

In other words we can say that the C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg.

C# is an object-oriented language, but C# also  support for component-oriented programming. Contemporary software design increasingly relies on software components in the form of self-contained and self-describing packages of functionality. Key to such components is that they present a programming model with properties, methods, and events.

They have attributes that provide declarative information about the component and they incorporate their own documentation. C# provides language constructs to directly support these concepts, making C# a very natural language in which to create and use software components.

Several C# features aid in the construction of robust and durable applications.

Garbage collection automatically reclaims memory occupied by unused objects;.

exception handling provides a structured and extensible approach to error detection and recovery and the type-safe design of the language makes it impossible to read from uninitialized variables, to index arrays beyond their bounds, or to perform unchecked type casts.

C# has a unified type system.

All C# types, including primitive types such as int and double, inherit from a single root object type. Thus all types share a set of common operations, and values of any type can be stored, transported, and operated upon in a consistent manner. Furthermore, C# supports both user-defined reference types and value types, allowing dynamic allocation of objects as well as in-line storage of lightweight structures.

To ensure that C# programs and libraries can evolve over time in a compatible manner, much emphasis has been placed on versioning in C#’s design. Many programming languages pay little attention to this issue. As a result, programs written in those languages break more often than necessary when newer versions of dependent libraries are introduced.

Example of C # language -:

using System;

class Hello
static void Main() {
Console.WriteLine(“Hello, World”);

C# source files typically have the file extension .cs. Assuming that the “Hello, World” program is stored in the file hello.cs, the program can be compiled with the Microsoft C# compiler using the command line

csc hello.cs

which produces an executable assembly named hello.exe. The output produced by this application when it is run is

Hello, World

The “Hello, World” program starts with a using directive that references the System namespace.

By the help of C# language we can developed following application

  • Window applications
  • Web applications
  • Distributed applications
  • Web service applications
  • Database applications



Leave a Comment