Welcome to C#

 

Welcome to C#


In this article you will be able to-
  • Introducing C-Sharp (C#) And .NET framework
  • Download and Install Visual Studio 2019
  • Use the Microsoft Visual Studio 2019 programming environment
  • Create a C# console application
  • Explain the purpose of namespaces

Introducing C-Sharp (C#) And .NET framework

What is C-Sharp (C#)?

C# (pronounced "See Sharp") is a general-purpose,  modern, object-oriented, and type-safe programming language. It was developed by Microsoft lead by Anders Hejlsberg and his team. And was approved by the European Computer Manufactures Association (ECMA) and International Standards Organization (ISO). C# has its roots in the C family of languages and will be immediately familiar to C, C++, Java, and JavaScript programmers.

C# Used for

  • C# features and its advantage 
  • C# provides powerful features such as-
  • Nullable types
  • Delegates and event management
  • Properties and events
  • Indexer 
  • LINQ and lambda expression
  • pattern matching
  • and safe direct memory access.

and more…

C# supports-

Generic methods, and types, which provide increased type safety and performance. C# provides iterators, which enable implementers of collection classes to define custom behaviors for client code. Language-Integrated Query (LINQ) expressions make the strongly typed query a first-class language constructor.

C# features and its advantage 

As an object-oriented programming language, C# supports the concept of -

  • Inheritance 
  • Encapsulation
  • Polymorphism and 
  • Abstraction  

 Why Use C#?

  • It is a modern, general-purpose programming language.
  • It is one of the most popular programming languages.
  • It is object-oriented.
  • It is a component oriented. 
  • C# is a structured language. 
  • It is produces efficient programs. 
  • Compiled on a variety of computer platforms. 
  • It is easy to learn. 


.NET Platform Architecture

C# programs run on .NET, a virtual execution system called the common language runtime (CLR) and a unified set of class libraries. The CLR is the commercial implementation by Microsoft of the common language infrastructure (CLI), an international standard. The CLI is the basis for creating execution and development environments in which languages and libraries work together seamlessly.

The .NET framework applications are multi-platform applications. The framework has been designed in such a way that it can be used from any of the following languages: C#, C++, Visual Basic, Jscript, COBOL, etc. All these languages can access the framework as well as communicate with each other.

Introduction to .NET

.NET is a free, open-source development platform for building many kinds of apps, such as:

  • Web apps, web APIs, and microservices 
  • Serverless Functions in the cloud
  • Cloud Native Apps
  • Mobile Apps
  • Desktop Apps
  • Windows WPF
  • Windows Forms
  • Universal Windows Platform (UWP)
  • Games
  • Internet of Things (IoT)
  • Machine Learning 
  • Console apps
  • Windows Services


You can download Visual Studio 2019 from the below link-

So, Let's download and install it 

Step-1:





Beginning programming with the Visual Studio 2019 environment

Visual Studio 2019 is a tool-rich programming environment containing the functionality that you need to create large or small C# projects. We can can construct projects that seamlessly combine modules written in different programming languages such as C++, Visual Basic, and F#. 

First of all you need to create a Console Application for learning purpose.
A console application is an application that runs a command prompt window rather than providing a graphical user interface (GUI)


Perform the following step to create a new console application:

Step-2: 
  • Open Visual Studio
  • Click on Create a new project




 Step-3:

  • Search console in the search box
  • Select Console App (.NET Framework) | Note: ensure the language C#
  • Click on Next




Step-4:
  • Type the project name 
  • Chose the project location, where you want to save the project it's up to you.
  • Then click on Create button





 Step-5:

  • Finally Console application project successfully created.

  • Solution 'FirstConsoleApp' - This is the top level solution file. Each application contains a single solution file. A solution can contains one or more projects, and Visual Studio crates the solution file to help organize these projects. 
  • FirstConsoleApp - This is the C# project file. Each project file references one or more files containing the source code.
  • Properties- This is the folder in the FirstConsoleApp project. If you expand the properties option, you will see that it contains a file called AssemblyInfo.cs. AssemblyInfo.cs is a special file that you can use to add attributes to a program, such as the name of the author, the date the program was written, and so on.
  • References - This folder contains references to libraries of compiled code that your application can use. C# code is compiled, it is converted into a library and given a unique name. In the Microsoft .NET Framework, these libraries are called assemblies
  • App.config - This is the application configuration file. It is optional, and it might not always be present. 
  • Program.cs - This is a C# source file, and it is displayed in the Code and Text Editor window when the project is first created.
Note: Remember that, C# is a case-sensitive language. You must spell Main with an uppercase M.


Step-6:
Let's get started the coding... by using Microsoft IntelliSense




Step-7: Run the project by click on Start or press F5



Step-8: Namespaces and Assemblies





post will continue...

Comments