Introduction to C#
C# late in the 1990s and was part of Microsoft’s overall .NET strategy.
The choice of a language depends upon many
factors such as hardware environment, business environment user requirements
and so on.
and C++ are the two popular and most widely used languages in the software
industry for the past two decades. However these languages suffer from number
of shortcomings such as high complexity, not truly object oriented, not
suitable for working with web technologies, poor type safety etc.
VB – not truly an object oriented language
and becomes increasingly difficult to use when systems becomes large.
Microsoft wanted an environment that is
completely in tune with current and emerging Web-programming practices and one
that easily integrates with existing systems. Microsoft therefore wanted to
design a new language starting with a clean state. The result is C#.
architect was Anders Hejlsberg.
In January 1999, at Microsoft, Anders
Hejlsberg formed a team to build a new language at the time called Cool,
which stood for "C-like Object Oriented Language". By the time
the .NET project was publicly announced at the July 2000
Conference, the language had been renamed C#.
C# is directly
related to C, C++, and Java.
retains the power of C and C++ and the elegance of java.
C# derives its
syntax, Keywords and Operators from C.
All executable statements must end with a semicolon.
keywords are declared in lower case.
operator set from C, including ==(comparison equal to), ++(increment operator),
(decrement operator), bitwise operator etc., are retained in C#.
C# builds upon
and improves the object model defined by C++.
C# has been derived from and belongs to the family of C/C++,
at the same time; it simplifies and modernizes
C# is purely object oriented. For
example, C# does not support for multiple inheritance, and all classes are derived from the class
called System. Object class.
C# simplifies C - integer and Boolean are different
the use of -> operator for referring to members of a type’s instance
C# and .NET Framework
is a computer language that has a special relationship to its runtime environment,
C# is the first and one and only language
that is developed from the clean state to target .Net Framework.
By design, C# is the programming language
that most directly reflects the underlying Common Language Infrastructure (CLI).
Most of its intrinsic types correspond to
value-types implemented by the CLI framework.
Some of the components of .Net framework
are actually coded in C#.
libraries used by C# are the ones defined by the .NET Framework.
Any language, that target .Net Framework,
use libraries defined in .Net Framework.
Further, all the features defined at the
framework level are available to the language.
C# and OOPS
The entry point method of a C# program is
the Main() method. The Main() method is supposed to be placed inside a type
definition i.e., a class definition or a structure definition. Thus, C# forces
to have at least one type defined in a program. By this way, any C# program is
to some extent object oriented.