
C # lives by the principle “every essence is an object”. It is ranked as object-oriented, or rather object, programming languages. "The language is based on a strict component architecture and implements advanced mechanisms for ensuring the security of the code," it is customary to characterize it. However, skeptics doubt at least his safety.
Proponents of C # call it the most multi-paradigm, universal, advanced and easy-to-use programming language. Considering the fact that the Microsoft .NET platform is behind it, the number of such supporters is quite large.
')
Ancestors
Distant ancestors of C # appeared back in the 60s. It all started with the advent of language B, which in 1969 was created by a team of developers from the Massachusetts Institute of Technology (MIT). The main author of B is Ken Thompson. Then the team worked on the UNIX operating system. The already existing PL / I language, which was used at that time for IBM mainframes, was rather cumbersome and less suitable for the task at hand. Therefore, scientists decided to create a new language, which was named B. It is a typical representative of the early imperative programming languages.
After B, oddly enough, followed C, which was invented in 1972. The basis for the new language was B. himself.
The creators of C were Ken Thompson and
Denis Ritchie , who worked in the AT & T research laboratory (AT & T Bell Telephone Laboratories). In 1971, Ritchie began to create an expanded version of B. At first he called it NB (New B), but when the language became very different from B, the name was changed to C. B expanded due to the explicit use of types, structures and a number of new operations.
Regarding the emergence of the C language, Peter Moylan in his book “The case against C” wrote: “A language was needed that could bypass some of the hard rules built into most high-level languages and ensure their reliability. We needed a language that would allow us to do something that before it could be implemented only in assembly language or at the level of machine code. ”
Image from the Book of C Language: M. Waite, S. Prata, D. MartinIn 1984,
Bjarne Straustrup (Bell Labs) presented a C ++ project. When Stroustrup was engaged in research in the company, he needed to write several simulation programs to simulate distributed computing. SIMULA-67 - an object-oriented language - could be an ideal tool for solving such problems, if not for its relatively low speed of program execution.
If you have to choose between writing "good" and "fast" code, it means that there is something wrong here. Because “good” code must be “fast,” Stroustrup explains his position in an interview.
Thus, the C ++ programming language was created, originally called “C with classes” (C with classes). The name “C ++” was coined by Rick Maschitti. "++" is an increment operator in C, which seems to hint that the C ++ language is more than just C.
C #
Microsoft decided to mark the Millennium with the release of new software products. By 2000, the company had prepared industrial versions of new component technologies and solutions in the field of messaging and data, as well as creating Internet applications (COM +, ASP +, ADO +, SOAP, Biztalk Framework). In support of these innovations, Microsoft has released an application development toolkit - the .NET platform. She also united several programming languages "under one roof", which was a novelty for that time.
Another innovation of the .NET platform was the technology of Active Server Pages (ASP.NET) (Active Server Page). With its help, it was possible to develop web applications interacting with databases relatively quickly.
The C # programming language was created specifically for ASP.NET. ASP.NET itself was completely written in C #.

The name "C Sharp" (from the English. Sharp - sharp) has a "sacred" meaning. The “#” sign (in musical notation is read as “sharp”) means an increase in pitch by half a tone. On the other hand, the name “C #” is obtained by the following “evolutionary chain”: C → C ++ → C ++++ (C #), since the “#” symbol can be made up of 4 “+” signs.
Due to technical limitations on the display (standard fonts, browsers, etc.) and the fact that the sharp ♯ character is not represented on the standard keyboard, the # sign was chosen to represent the sharp character when writing the name of a programming language. This agreement is reflected in the C # ECMA-334 Language Specification. The names of programming languages are not taken to be translated, therefore the language should be called in English "C. Sharp".
The authors of this programming language were Scott Wiltamut and Anders Hejlsberg, the creator of Turbo Pascal and Delphi, who transferred to Microsoft in 1996.
According to one version, he was nurturing the idea of a new language and even a new platform (which now bears the name .NET), while still working at Borland.
C # supports all three "pillars" of object-oriented programming: encapsulation, inheritance, and polymorphism. In addition, it implemented automatic “garbage collection”, exception handling, dynamic binding.
Java comparison
Like Java, C # was originally intended for web development, and approximately 75% of its syntactic features are similar to the Java programming language. It is also called the “cleaned version of Java.” 10% is borrowed from C ++, and 5% is from Visual Basic. And about 10% of C # is the implementation of the developers own ideas.

Despite the very significant differences between the component object model of COM (the main standard of Microsoft for component design and implementation of software) and the Java model, programming languages have quite a lot in common.
The unified program runtime is based on the use of the IL intermediate language (Intermediate Language), which plays almost the same role as the Java virtual machine bytecode. The compilers used in the .NET technology from various languages translate programs into IL code. Like the Java bytecode, the IL code is a command from a hypothetical stack computer. But there is a difference in the design and use of IL.
First, unlike the JVM, IL is not tied to a single programming language. As part of the preliminary versions of Microsoft.NET, there are C ++, C #, Visual Basic compilers. Independent developers can add other languages by creating their compilers in the IL code.
Secondly, IL is not intended for software interpretation, but for subsequent compilation into machine code. This allows you to achieve significantly higher performance programs. Files containing IL-code carry enough information for an optimizing compiler to work.
Microsoft's Kick Radek considers C # to be a more complex language than Java. In his opinion, “the Java language was built in such a way as to protect the developer from being shot at his own foot” (eng. “Java was built in the foot”), and “C # was built so that give the developer a gun, but leave it on the guard ”.
Versions
Work on C # began in December 1998. The project received the code name COOL (C-style Object Oriented Language).
The first beta version of C # 1.0 was released in the summer of 2000, and in February 2002, the final version of the language was released with Microsoft Visual Studio. Since C # combines the best aspects of popular programming languages like C, Java, and C ++, it is easy for programmers to make the transition to C # based on their knowledge of any of the languages listed.
The main difference from the predecessors was the ability to write components. In C #, tools such as events, methods, and properties have appeared.
In 2005, the final release of C # 2.0 was released. This strengthened its position in the market. Adding new features, such as anonymous methods, generalizations, partial and parameterized types, greatly expanded the possibilities of using C #.
In the second version, support for 64-bit computing was added, which opened up the possibility of increasing the address space. It also implemented the creation of triggers, stored procedures and data types in .NET languages.
Version 3.0, released in 2008, allowed C # to get ahead in the “arms race” of programming languages. Among the innovations, C # 3.0 is an integrated query language (LINQ); not explicitly typed variables and extension methods; Lambda expressions that assign code implementation to delegates using a new, simpler syntax. Lambda expressions were particularly distinguished along with the language of integrated queries.
Anonymous variable types made it possible to avoid cumbersomeness and frank inconvenience in describing variables, making it possible to declare a new type immediately upon its creation. A novelty in C # 3.0 is also the so-called “lazy calculations”, which perform the necessary calculations only when requesting the necessary relevant data.
In 2010, C # 4.0 was released. Its main addition to previous versions are named and optional arguments. The former enable the binding of an argument and a parameter by name, and the latter allow you to specify the default argument for each parameter. No less important is the dynamic type. It allows you to check for conformity of object types not at the compilation stage, but directly during program execution.
At the same time, innovations appeared in the .NET Framework 4.0 - the task parallelization library (TPL) and the parallel version of the integrated query language (PLNQ). Their support allows parallel execution of code in computers with multi-core processors or several single-core ones.
Version C # 5.0 appeared in 2012. It was implemented quite a few innovations:
• Asynchronous methods
• The operation of obtaining information about the caller

Version C # 6.0
This version was released three years after the fifth version was released - in 2015. Its
main innovations are :
• Initialization of properties with values
In C # 6.0, you can initialize properties with values. This helps to avoid errors with null and empty property values.
• Interpolation of lines
Every day we have to deal with concatenation of strings. Someone basically uses the “+” operator, someone - the string.Format () method. But the problems with it are known to all: with too many parameters it is hard to understand what each number means - {1}, {2}, {3}. In C # 6.0, a new feature was invented, which should combine the merits of both methods.
• Using lambda expressions
In C # 6.0, properties and methods can be defined via lambda expressions. This greatly reduces the amount of code.
• Import static classes
All static class members can be defined using another static class. But we have to constantly repeat the name of this static class. With a large number of properties, you have to repeat the same thing many times.
C # 6.0 introduced the ability to import using the keyword using static classes.
• Null-conditional statement
C # 6.0 introduces a new so-called Null-conditional operator (?.), Which will work on top of the conditional operator (? :). It is designed to facilitate checking for null values.
It returns null if the class object to which the statement is applied is null.
• nameof operator
In C # 6.0, the nameof operator will be used to avoid the appearance of string literals of properties in code. This operator returns the string literal of the element passed to it. As a parameter, you can pass any member of the class or the class itself.
• Await in catch and finally blocks
Prior to C # 6.0, it was not possible to use the await statement in the catch and final blocks. It can be used to free up resources or to log errors.
• Exception filters
Exception filters were in the CLR, but only in VB. Now this feature has appeared in C #, and you can impose an additional filter on exceptions.
• Initialization Dictionary
In C # 6.0, the ability to initialize Dictionary by key value is added. This should simplify the initialization of dictionaries.
Also, Microsoft has improved the new compiler in terms of performance.

C # 7.0
In 2016 it
became known about the innovations of the upcoming version C # 7.0:
• Binary literals
• Local Functions
They allow you to structure the code, for example, in the style of JavaScript.
• Pattern matching
Now you can use a variety of tools for matching.
• Conditions and use of objects in switches
Little revolution for developers. Now switch is almost unlimited. You can use mappings.
• Records
Automatic creation of simple classes with arbitrary fields.
• Tuples
Sometimes you want to return several values from a method. To simplify this task, tuples and tuple literals have been added to C # 7.
Prospects C #
“More and more companies are choosing the Microsoft .NET platform for large projects, Mikhail Flenov
writes in his blog. “And everything is simple, Java lost its freedom when it went under the wing of Oracle.” Before this transition, Sun was spending huge resources on this language and doing a lot for the sake of freedom, open source and just Java. With the transition under the wing of Oracle, the language is still lost, began to develop more slowly.
In the case of .NET, Microsoft makes a lot more effort. The language is still developing quite seriously, the company has released a free code editor for all platforms, and is just starting to invest in openness, does everything that releases .NET.
It is difficult to say now what will happen with Windows in the future, but so far this platform will remain the most popular. And here C # is gaining popularity. Microsoft continues to invest in its mobile platform and if they bear fruit, then C # can even more seriously shoot, ”he concludes.