by Dinesh Thakur Category: Introduction to C#

C# has a strong feature in which we can define more than one class with the Main method. Since Main is the entry point for the program execution, there are now more than one entry points. In fact, there should be only one entry point. Which will be resolved by specifying which Main is to be used to the compiler at the time of compilation as shown below:

by Dinesh Thakur Category: Introduction to C#

Command line arguments are parameters supplied to the Main method at the time of invoking it for execution. To understand the concepts see the example given below:

Program of Command line argument to accept name from the command line and writes to the console. (Sample.cs)

by Dinesh Thakur Category: Introduction to C#

When many people work in creating the same program, it could be difficult to keep track of the names of various classes. If more than one programmer creates a class with the same name in the same program, there would be conflict and the program would not work. The solution to avoid this situation is to delimit sections of code with names.

by Dinesh Thakur Category: Introduction to C#

Like C++ it contains three types of statements.

1. Simple Statements

2. Compound Statements

3. Control Statements

by Dinesh Thakur Category: Introduction to C#

Let's begin in the traditional way, by looking at the code of a Hello World program.

1. using System;

2. public class HelloWorld

3. {

4. public static void Main()

5. {

6. II This is a single line comment

7. /* This is a

8. multiple

9. line comment */

10. Console.WriteLine("Hello World! ");

11. }

12. }

by Dinesh Thakur Category: Introduction to C#

C# is a type-safe language Variables· are declared as .being of a particular type; and each variable is constrained to hold only values of its declared type.

Variables can hold either value types or reference types, or they can be pointers. Here's a quick recap of the difference between value types and reference types.

by Dinesh Thakur Category: Introduction to C#

C# uses a series of words, called keywords, for its internal use. This means that you must avoid naming your objects using one of these keywords.

by Dinesh Thakur Category: Introduction to C#

Identifiers refer to the names of variables, functions arrays, classes, etc. created by programmer. They are fundamental requirement of any language. Each language has its own rules for naming these identifiers.

by Dinesh Thakur Category: Introduction to C#


All the Syntax of java is like C++. There is no preprocessor and much larger library. C# code does not require header files. All code is written inline.

by Dinesh Thakur Category: Introduction to C#

Microsoft Corporation developed a new computer programming language C# pronounced as 'C- Sharp'. C# is a simple, modem, object oriented, and type safe programming language derived from C and C++. C# is a purely object-oriented language like as Java. It has been designed to support the key features of .NET framework. Like Java, C# is a descendant language of C++ which is descendant of C language.

by Dinesh Thakur Category: OOP's in C#

Method overriding means same name methods in different classes.

Polymorphism is a feature to use one name in many forms. There ·Polymorphism can be achieved in following ways in C#:

by Dinesh Thakur Category: OOP's in C#

Inheritance is a mechanism of sharing the members among the classes. Inheritance means taking an existing class and adding functionality by deriving a new class from it. The class you start with is called the base class, and the new class you create is called the derived class.

by Dinesh Thakur Category: OOP's in C#

Constructor is method of class to allocate the memory of object and initialize the variables of class.


When you declare a variable of a class, a special method must be called to initialize the members of that class. This method is automatically provided for every class and it is called a constructor.

by Dinesh Thakur Category: OOP's in C#

One can create new reference types by defining classes. Classes provide templates' from which these direct instances are generated. Where we appeal to the relation between a class and its corresponding reference type instances we shall say that a class specifies the type (also that the class specifies the constitutive elements of the type)

by Dinesh Thakur Category: OOP's in C#

Object-Oriented programming emphasis on data rather than function.

Object-Oriented programming was developed due to the limitations of the traditional programming approaches. The traditional programming approaches, such as Pascal, C, BASIC, FORTRAN and etc., are basically called procedural-oriented programming languages.

by Dinesh Thakur Category: Advanced C#

Another important and exciting feature object-oriented programming is Operator overloading. C# supports the concept of operator overloading.

Operator overloading is a concept in which operator can defined to work with the userdefined data types such as structs and classes in the same way as the pre-defined data types.

by Dinesh Thakur Category: Advanced C#

Application development as the name suggest is a development process. With time, new functionality is added to current applications and hence different versions of the application come to existence. Application development for quite sometime has been focused towards component oriented development. Hence an upgrade of the application definitely means an upgrade of the components. These components need to be versioned along with the application. Often components alone can face an upgrade-offering new functionality. When this happens, existing clients face a problem when the component they reference is upgraded. Net assemblies attempt to solve this problem by embedding the version information into the assembly itself. With the advanced capabilities of Windows 2000, two different assemblies can be loaded into the memory side-by-side.

by Dinesh Thakur Category: Advanced C#

An attribute is a declarative tag, which can be used to provide information to the runtime about the behavior of elements of application such as classes and assemblies.


Attributes are used to give extra information to the .NET compiler. C# and the .NET framework have a few built-in attribute types, but it is also possible to create new ones by extending the system Attribute class. Below we describe a few common uses of attributes.

by Dinesh Thakur Category: Advanced C#

In object-oriented languages, objects expose encapsulated functions called methods. Methods are encapsulated functions which run when they are invoked.

Sometimes, however, we think of the process of method invocation more grandly. In such a case, the method invocation is termed an 'event', and the running of the method is the 'handling' of the event. An standard example of an event is a user's selection of a button on a graphical user interface; this action may trigger a number of methods to 'handle' it

by Dinesh Thakur Category: Advanced C#

Delegate is a method template which used to implement the concept of function pointer.


The C and C++ languages are having the concept of function pointer. This was even more useful when programming for the Microsoft Windows operating systems because the Win32 library relies on the concept of callback functions. Callback functions are used in Microsoft Windows programming to process messages. For this reason and because of their functionality, callback functions were carried out in the .NET Framework but they were defined with the name of delegate.


Page 2 of 3

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.