C# is a modern, simple yet general-purpose Object-oriented programming language that has been developed by Microsoft and runs on its .NET Framework. This multi-paradigm language is versatile and the C# learning path is also easy that can be used to perform a huge range of works and objectives to spread over a variety of professions. Primarily, C# was used on the .NET Framework; however, it can be applied to an open-source platform.
C# is a typed safe, object oriented and managed language which is compiled by the .NET Framework and was developed by Microsoft in the year 2000. The ideas behind creating C# language is that it can be used in the development of all kinds of software aiming at various platforms like Mobile, Web, Windows by using only one programming language. At the resent day, it is one of the most famous programming languages across the world with millions of C# developers are using this language to build all types of software.
It can use of Constructors and Destructors
Object Oriented and general purpose
Easy to grasp
Part of .NET Framework
Structured Language
Platform independent for compilation
There are so many reasons for the usage of C# language as a programming platform. Some of them are given below:
Component oriented language
Easy to pickup
Produces readable and efficient programs
Follows as a structured approach
Passing parameters is easy
Once written, then can be compiled n different platforms
Single line comments: //hello, this is a single line comment
Multiline comments:
XML comments: ///Hello this is XML comment
Given below are the access modifiers used for general purpose:
Public: When any method or attribute are defined as public, then it can be accessed from any part of code
Protected: When a user will define an attribute or method as protected then it can only be accessed within that class and the one inheriting the class
Private: A private method or attribute can be accessed within the class only.
Internal: An internal method or attribute can be accessed from that class at the present assembly position.
Protected Internal: The access of this kind of method or attribute is restricted to classes within the present project assembly or on different types which are only defined by that class.
It has four steps as mentioned below:
Finally Block is called after the execution of catch and tries blocks. It is used to handle exceptions whether or not the exception has been caught this block of code to get executed. Basically, such a block of code has a cleaner code.
Finally, method is called just before the garbage collection. The man's aim is to perform a cleanup operation for any unmanaged code and it will automatically invoke when an instance is not being called.
Managed Code can be executed by Common Language Runtime (CLR) which means all the application code is dependent on the .NET Platform which is considered as overseen in view of them.
Unmanaged Code is any code that can be executed by runtime application of some different structure from the .NET Platform. The runtime application may deal with security, money, and other execution activities.