C# TUTORIAL FOR BEGINNERS

C# Programming Language

OVERVIEW:

Microsoft C# (pronounced C sharp) is an object oriented programming language designed for building a wide range of enterprise applications that run on the .NET Framework. The .Net framework is a revolutionary platform that helps you to write Windows applications, Web applications, Web services.

The .Net framework applications are multi-platform applications. It consists of an enormous library of codes used by the client languages such as C#, C++, Visual Basic, Jscript, COBOL, etc. Following are some of the components of the .Net framework:

  • Common Language Runtime (CLR) ( which enables c# to be compiled on a variety of computer platforms )
  • The .Net Framework Class Library
  • Common Language Specification
  • Windows Forms
  • ASP.Net and ASP.Net AJAX  etc.

BASIC EXAMPLE :

A C# program consists of the following parts:

  • using statements  // the using keyword is used to include namespace in the program, a program has generally many using statements.
  • Namespace declaration // A namespace is a collection of classes, In the following program, The HelloWorldApplication namespace contains the class HelloWorld.
  • class declaration statements // the class contains the data and method definitions that your program uses
  • Class methods
  • Class attributes
  • A Main method
  • Other Class Methods
  • Statements and Expressions
  • Comments

COMPILING AND RUNNING : USING VISUAL-STUDIO or COMMAND-LINE :

USING VISUAL-STUDIO:

Start Visual Studio -> (choose File -> New -> Project) -> Choose Visual C# from templates, and then choose Windows -> Console Application -> click OK button after specifying the name of your project -> This creates a new project in Solution Explorer -> Write code in the Code Editor -> Click the Run button or press F5 key to execute the project.

USING COMMAND-LINE:

Save the file as helloworld.cs -> Open the command prompt tool and go to the directory where you saved the file -> Type csc helloworld.cs and press enter to compile your code -> If there are no errors in your code, the command prompt takes you to the next line and generates helloworld.exe executable file -> Type helloworld to execute your program.

OUTPUT:

ALL IN ONE EXAMPLE -> EXPLAINING MULTI-THREADING, INHERITANCE,  INTERFACES,  ACCESS-SPECIFIERS, POLYMORPHISM(OVERLOADING), EXCEPTION-HANDLING, FILE INPUT-OUTPUT, ATTRIBUTES, EVENTS, DELEGATES ETC.

 

Leave a Comment

Your email address will not be published. Required fields are marked *