C#/ C Sharp
C# is a .Net Framework programming language. C# which is also knows as “C Sharp”. C # is based on OOPS concept which is provide by Microsoft and C# run on .Net Framework. C# based on Object orientation Programming so the features of OOPS like, Data Hiding, encapsulation, inheritance, polymorphism etc are used. C # is designed for common Language Infrastructure which is also pronounced as CLI. CLI is a specification that tells runtime environment and executable code.
We can development variety of Application through C# language i.e.:
- Web Application
- Web service Application
- Window Application
- Distributed Application
- Mobile Application
- Database Application
.Net Framework: -
.Net framework is used to make both Form-Based Application and Web-Based Application.
Below is some of components of .Net framework are:
- Common Language Runtime (CLR)
- Common Language Specification
- Windows Presentation Foundation
- Metadata and Assemblies
- The .Net Framework Class Library
- Windows Communication Foundation (WCF)
- Common Type System
- Windows Workflow Foundation (WF)
How C# program Execute
C# → # compiler → Common Language Interpreter.
Microsoft Provides Different types of Development Tools for C# are given below:
- Visual studio 2010
- Visual C# 2010 Express
How to Install Visual Studio for Window OS
- Run Downloaded vs_community__15414.exe file.
- Click on continue button on Next screen.
- Wait for some minute, Visual studio start downloading the necessary file.
- After Download, the next screen will show for products. Choose products as per Requirement. After Choosing product, click on install.
Sometimes If you already chosen Product at downloading time. Then This screen will not show in this step.
- In next screen, Choose the Development Environment and click on Install. You can select multiple Environment.
- Now Visual Studio Community 2017, Start downloading some initial files and install packages.
- Once Download Completed, It will ask to Reboot computer. Select Restart. (Highly Recommended)
- IDE open after Post Reboot.
- Choose the Theme color of IDE.
- Click on Start Visual Studio. IDE Screen Will Come.
How to Create Program in Visual Studio
In Above IDE We have Successfully Create “Hello World!” Program:
- Start Visual Studio
- Select “Create a New Project” Option.
- Choose Which types of Application you want to developed. Here Console App (.Net core) is selected. Click on Next button.
- Configure Your Next Project in this screen. Write Project name. By Default, Location will be “C:\Users\Sam\source\repos”. Do not need to select location option. Click on Create button.
- IDE Will open. The automatically some code will generated.
- Click On “ConsoleApp5” Menu, which is pointed by “Red” Arrow.
- Below Output Will come.
static void Main(string args)
Lets Here are explained different parts of the above executed Program:
- In The first line “using System”. This include the systems namespace in the program. There are various multiple using statement in a program.
- Namespace Declaration: It is the collection of classes. So, in this program Program class it contains.
- Class Declaration:The class Program contains the method and data definitions that your program using here.The Program class has only one method Main.
- 4. In the next line, Main method Has been declared, which is the entry point for all C# programs.
- Within the Main Method, we have defined the behaviour with statement Console.WriteLine("Hello World");