Home To Know What is C#?

What is C#?

223
0
SHARE
What is C#?

Introduction

Microsoft included an Object base language called C Sharp(C#). C-Sharp is designed to be easy, objectoriented programming language, modern, general-purpose, borrowing key concepts from several other languages, most notably java. C-Sharp could theoretically be compiled to machine code, but in real life, it’s always used in combination with the .NET framework. Therefore, applications written in C#, requires the .NET framework to be installed on the computer running the application. While the .NET framework makes it possible to use a wide range of languages.

It uses the Microsoft .Net framework and the Mono framework to be interpreted and translated into a language that is capable of running fast on any computer C Sharp is the third most popular language to be use with these frameworks.

C# Source code compiled into an intermediate language (IL) that Sends report to the CLI specification. The IL code and resources, such as images and strings, are stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. An assembly contains a manifest that provides basic information about the assembly’s types, version, culture, and security requirements.

When the C# program is executed, the assembly is loaded into the CLR, which might take various actions based on the information in the manifest. Then, if the security requirements are met, the CLR performs just in time (JIT) compilation to convert the IL code to native machine instructions. The CLR also provides other services related to automatic garbage collection, exception handling, and resource management. Code that is executed by the CLR is sometimes referred to as “managed code,” in contrast to “unmanaged code” which is compiled into native machine language that targets a specific system. The following diagram illustrates the compile-time and run-time relationships of C# source code files, the .NET Framework class libraries, assemblies, and the CLR.

Compile-Time & Run-Time Relationships of C# Source Code Files
Compile-Time & Run-Time Relationships of C# Source Code Files

C# doesn’t Support global variables or functions. Everything is wrapped in classes, even simple types. This inherits from the System.Object class.

Further we will guide you to understand C# language in a better way.

History

C# is object-oriented language same as java. C-Sharp is to be a simple, modern, general-purpose, object oriented programming language from Microsoft that started around 1997. C# also known as C sharp is available to run on multiple platforms, such as Windows, Linux and Solaris.

Anders Hejlsberg was the lead architect and principal designer of C#, he was involved with the design of Turbo Pascal, Embarcadero Delphi and Visual J++ before the creation of C sharp. The design of C# was driven by flaws in most major programming languages such as C++, Java, Delphi and Smalltalk, according to Anders Hejlsberg.

C# however, was called an imitation of Java, by James Gosling, the creator of Java programming language and the co-founder of Microsystems Bill Joy, the originator of Java. Gosling went on to say that C# doesn’t have the reliability, productivity and security features that Java can offer programmers.

Anders Hejlsberg that C# that C# is much closer to C++ in its design than to java, but the authors of C++ Klaus Kreft and Angelika Langer claimed in a blog post that java and C# are almost identical programming languages, they said that the language was a “boring repetition that lacks innovation“, “Hardly anybody will claim that java or C# are revolutionary programming language that changed the way we write programs” and ”C# copied a lot from java”.

Software robustness, durability, and programmer productivity are important for this language to achieve. The originators of the language wanted the language, and implementations of it to provide support for software engineering by doing tasks that some languages require to be done with long processes such as doing uninitialized variables, and automatic garbage collection.

Support for international languages is very important for C sharp as well, because hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions are intended to be suitable for writing applications with C#.

Program Structure

C# is an object-oriented programming language. In Object-Oriented Programming, a program consists of various objects that interact with each other by means of actions. The actions that an object may take are called methods. Object is also called “Access-or”. ”Access-or” Means Fetching the class things and perform the operations.

For Example

Let us look at a simple code that world print the words “C Sharp Language World”. Every program runs from Main method. This is a starting point of any program.

This program is consists following parts: import System namespace, make new namespace for current class, a class, A Main method, comments and statements.

Example: 1


Example 1 Input
Example 1 Input

Example 1 Output
Example 1 Output

Example: 2


Example 2 Input
Example 2 Input

Example 2 Output
Example 2 Output

This example make a class name “Abc”. That contains a method name “a”. class method is access by class object(a1). Object is a instance for class.

Abc a1; // instance for class
New Abc();

New is a keyword that is used to allocate the memory for object. Abc() its call the default constructor. Every program calls the default constructor. In brief we will discuss about constructor further.

Leave a Reply