Introduction To C# (C-Sharp) Programming
Introduction To C# (C-Sharp) Programming
C# was developed by Anders Hejlsberg and his team during the development of .Net
Framework.
C# could theoretically be compiled to machine code, but in real life, it's always used in
combination with the .NET framework. Therefore, applications written in C#, requires the .NET
framework to be installed on the computer running the application. While the .NET framework
makes it possible to use a wide range of languages, C# is sometimes referred to as THE .NET
language, perhaps because it was designed together with the framework.
Language interoperability is the ability of code to interact with code that is written by using a
different programming language.
Purpose of C# Language
Microsoft .NET was formerly known as Next Generation
Windows Services (NGWS).
It is a completely new platform for developing the next
generation of Windows/Web applications.
These applications transcend device boundaries and fully
harness the power of the Internet.
However, building the new platform required a language
that could take full advantage.
This is one of the factors that led to the development of C#.
C# is an object-oriented language derived from C and C++.
The motive of C# is to provide a simple, efficient,
productive, and object-oriented language that is familiar
and yet at the same time revolutionary.
Features of C#
C# is a programming language designed for building a
wide range of applications that run on the .NET
Framework.
Following are some basic key features of C#:
o Type-safety Checking
o Object-oriented Programming
o Garbage Collection
Association (ECMA)
o Generic Types and Methods
o Iterators
o Static Classes
o Nullable Types
o Auto-implemented Properties
o Accessor Accessibility
o Anonymous Methods
o Parallel Computing
o Auto-implemented Properties
o Partial Classes
Object-oriented Programming: Focuses on objects so that
code written once can be reused. This helps reduce time
and effort on the part of developers.
Type-safety Checking: Checked the overflow of types
because uninitialized variables cannot be used in C# as C#
is a case-sensitive language
Garbage Collection: Performs automatic memory
management from time to time and spares the programmer
the task.
Standardization by European Computer Manufacturers
Association (ECMA): Specifies the syntax and constraints
used to create standard C# programs.
Generic Types and Methods: Are a type of data structure
that contains code that remains the same throughout but the
data type of the parameters can change with each use.
Iterators: Enable looping (or iterations) on user-defined
data types with the for each loop.
Static Classes: Contain only static members and do not
require instantiation.
Partial Classes: Allow the user to split a single class into
multiple source code (.cs) files.
Anonymous Methods: Enable the user to specify a small
block of code within the delegate declaration.
Methods with named Arguments: Enable the user to
associate a method argument with a name rather than its
position in the argument list.
Methods with optional Arguments: Allow the user to define
a method with an optional argument with a default value.
Nullable Types: Allow a variable to contain a value that is
undefined.
Accessor Accessibility: Allows the user to specify the
accessibility levels of the get and set accessors.
Auto-implemented Properties: Allow the user to create a
property without explicitly providing the methods to get
and set the value of the property.
Parallel Computing: Support for parallel programming
using which develop efficient, fine-grained, and scalable
parallel code without working directly with threads or the
thread pool.
There are Several Applications Of C#
C# is an object-oriented language that can be used in a
number of applications.
Gaming applications
Web applications
Mobile applications for pocket PCs, PDAs, and cell phones
Web services
Cloud applications
Simple standalone desktop applications such as Library
Management Systems, Student Mark Sheet generation, and
so on
Large-scale enterprise applications
Complex distributed applications that can spread over a
number of cities or countries
The CLR
Is the foundation of the .NET Framework.
Acts as an execution engine for the .NET Framework.
Manages the execution of programs and provides a suitable environment for programs to
run.
Provides a multi-language execution environment.
Is a backbone of .NET Framework
Performs various functions such as:
o Memory management
o Code execution
o Error handling
o Code safety verification
o Garbage collection