Complete Csharp fundamentals for version >1

Complete Csharp Fundamentals By Sagar Jaybhay

C# firstintroduced in July 2000 and released in2002

During the development of the language, it was named Cool.

History Link – VersionHistory

C# is object-oriented,type-safe programming language. C# isused for desktop, web application, mobile application, web API widely usedprogramming language.

C# provides component oriented programming.

C# developed by Microsoft under the .net framework.

It is evolved or has programming concepts based on C, C++, and Java.

Link to download: – https://visualstudio.microsoft.com/vs/community/

.cs is file extension means file contains c sharp code.

To compile code from command line use CSC filename.cs command and for running purpose .exe file with same as the file name is created and only placedfilename.exe I will run the program.

C# we strongly typed language and case sensitive programming language.

.Net Framework

.Net is a development platform which supports multiple programming languages like c#, F#

.Net framework is a softwareframework.

You can write a program in C# to develop a businessapplication personal application which runsthe on.Net framework

The mainly.netframework consists of CLR (CommonLanguage Runtime) and FCL (Framework Class Library).

Installation Path: – C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework

IL (IntermediateLanguage) –

It is partially compiled or half compile the code.

So what is need of Il code?

So when you develop an application you don’t know on which machine it will run or on which os version, CPU configuration you don’t know. So .net makes IL code.

Complete Csharp fundamentals for version loading=1" class="wp-image-175" data-srcset="https://sagarjaybhay.net/wp-content/uploads/2019/05/IL-Code.png 1002w, https://sagarjaybhay.net/wp-content/uploads/2019/05/IL-Code-300x118.png 300w, https://sagarjaybhay.net/wp-content/uploads/2019/05/IL-Code-768x301.png 768w" data-sizes="(max-width: 1002px) 100vw, 1002px"/>

Step:

  1. you write the code in c#, F# ,VC++,VB .net or .net compatible language.
  2. Compiler-like cse.exe, vbc.exe compiler compiles these code in half compile code or partially compiled.
  3. Then .net execution engine gives these half compile code to CLR common language runtime gives to JIT (just in time) compiler then JIT read every line by line of the code and convert it into platform-specific instruction or we can say it converts into a binary format which machine can execute. The machine doesn’t understand you half English code it read only 1 & 0.
  4. Then instruction gets executed.

CLR (Common Language Runtime)

CLR is an execution environment for.Net application. It is theheart of the .net framework.

  1. Garbage collection – background thread isrunning and see’s which object is not in use then reclaim its memory.
  2. Code verification – permission checks forapplication
  3. IL to Native translation

It brings life to the application by providing your environment.

Mainly it manages yourapplication for running and after your application competition.

It manages your application by providing services likeGarbage collection or Memory management. It virtualizesyour application means it’s most of the time your application runs on any operating system without yourconsideration.

Means you need not to worry about how many CPU cores are present or what kind of instruction set it uses for running your application.

CTS (Common TypeSystem)

The .Net frameworkuses many language vc++, vb .net, c#, F# there might be a situation where weneed to call one language application to another so CTS helps for that by enablingcross-language integration, type safety, and high-performancecode execution

Defines rules that languages must follow, which helps ensurethat objects written in different languages can interact with each other.

Provides primitive type lib like int, Boolean, char

C# has int Data Type and VB.Net has Integer Data Type. Hence a variable declared as an int in C# or Integer in vb.net, finally after compilation, uses the same structure Int32 from CTS.

Complete Csharp fundamentals for version loading=1" class="wp-image-177" data-srcset="https://sagarjaybhay.net/wp-content/uploads/2019/05/CTS-1024x272.png 1024w, https://sagarjaybhay.net/wp-content/uploads/2019/05/CTS-300x80.png 300w, https://sagarjaybhay.net/wp-content/uploads/2019/05/CTS-768x204.png 768w, https://sagarjaybhay.net/wp-content/uploads/2019/05/CTS.png 1200w" data-sizes="(max-width: 1024px) 100vw, 1024px"/>

CLS (common languagespecification)

It is set of specification rules to be followed

CLS stands for Common Language Specificationand it is a subset of CTS. It defines a set of rules and restrictions thatevery language must follow which runs under the .NET framework. The languageswhich follow these set of rules are said to be CLS Compliant. In simple words,CLS enables cross-language integration or Interoperability.

For Example

  1. if you take C-Sharp and VB.net in C# each and every statement must have to end with a semicolon it is also called a statement Terminator but in VB.NETeach and every statement should not end with a semicolon(;).

Explanation of the above Example

So these syntax rules which you have to follow from language to language differ but CLR can understand all the language Syntax because in.NET each language is converted into MSIL code after compilation and the MSIL code is language specification of CLR.

FCL (Framework ClassLibrary)

FCL is a standard library which is defined by CommonLanguage Infrastructure. FCL is a collection of reusable classes, interfaces, and value types.

FCL contains codewhich you use to build your application. Ex. Read-writedata from disk, regular expression, IO operation

BCL is called Based class Library which is the core of FCL which provides the most fundamentalfunctionality like System.

You may also like...

2 Responses

  1. May 2, 2019

    […] using that variable you need to assigned value to that variable else it throws compile time […]

  2. May 8, 2019

    […] These are 4 types of loop available in c#. […]

Leave a Reply

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