When we talk about C# programming, those who are not familiar with this topic will probably not understand much, in this article we will try to explain all about related to C#.
C# is an Object-Oriented Programming language designed by Microsoft. It was standardized in a while ago by the ECMA and ISO two of the most important organizations when creating standards for services or products.
this language has acquired the name of C Sharp is inspired by the sign #, this sign is pronounced as Sharp in English for musical notation. It is a play on words since “C#” musically means “do sharp”, where the sign # tells us that a note is a semitone higher.
Object-oriented programming is a branch of computing that uses as its name indicates the objects and their interactions to design applications and software. It should be noted that an object in programming is an entity that combines the state (are the data of the object), behavior or method (which defines what operations can do the object) and identity (is the differentiating factor of other objects).
C# is considered as the evolution and necessity of certain circumstances. Evolution by their predecessor languages that are C and C ++ and need at the time when the company had problems with the company that created the Java language. This is why C Sharp presents the positive attributes of C ++, Java and Visual Basic and improves them by providing a strong and updated language for current times.
History Of C# Language
I still remember the first time I took a look at C# in the early 2000s. Microsoft had released the first great version of the language. At that time I thought it was like Java, but made by Microsoft, that they had given it another name and they had put it inside Visual Studio. And he was not the only one who had thought this. In an old interview, Java’s father, James Gosling, had called it an imitation. “It’s a Java type with reliability, productivity, and zero security,” he had said. Buff!
There have been many changes in the last 15 years. I doubt anyone will make a similar assessment today. In this time, Java has released 4 major releases, while C# has released 6. The languages have taken different paths, and C# has experienced a lot of innovation. Today I would like to look back at the history of C# and highlight some of the keys in its evolution.
How was the language in its earliest versions? How has it evolved to date?
When you look back, the first version of C# itself looked a lot like Java. As part of its written design goals for ECMA, it ought to be a “modern and simple object-oriented general-purpose language”. At that time, I could have done something worse than looking at Java to achieve those ends.
But if you analyze version 1.0 of C# 1.0 today, you would be dizzy. It lacked solid asynchronous capabilities and many of the “polished” functionalities related to generics that we take for granted today. Actually, it lacked generics in general. AND LINQ? Nothing. That would take a few years to leave.
Version 1 of C # seemed to be quite devoid of functionality, compared to today. In the end, you saw yourself writing heavy code. But hey, as with any version 1.0: somewhere you have to start …
Here things start to get interesting. Let’s review some of the main features of C# 2.0, released in 2005, along with Visual Studio 2005 (do not forget to take a look at the book written by the creator of NDepend, Patrick Smacchia, on .NET 2.0, available in English and French).
- Partial types
- Anonymous methods
- Cancelable types
- Covariance and contravariance
Although Microsoft may have started with a fairly generic object-oriented language, version 2 of C# changed everything right away. They went to task after the release of the initial version and went for several of the frustrations it caused. And they did it very seriously.
Version 3 of C# appeared at the end of 2007, along with Visual Studio 2008, although full functionality would appear with version 3.5 of C#. And a little update turned out to be !. I would dare to say that that moment consolidated C# as a really formidable programming language. Let’s see some of its main features in this version:
- Self-implemented properties
- Anonymous types
- Query expressions – LINQ
- Lambda expressions
- Expression trees
- Extension methods
In hindsight, many of these characteristics seem both inevitable and inseparable. In fact, it is not easy to highlight one over the other as they all fit strategically very well together.
Others doing this same analysis will not have that problem and will say that, by far, the most important novelty of version 3 of C# was the query expressions, also known as LINQ ( Language Integrated Query ).
Version 4 of C# was born with the stigma of not supposing a breakthrough innovation as it had been its predecessor version 3. And is that with version 3, Microsoft made the language cease to be in the shadow of Java and began to stand out. The language was quickly becoming an elegant choice.
Anyway, version 4 of C# did introduce some cool things.
- Dynamic types
- Optional arguments and named
- Generic covariance and contravariance
- Embedded interop types
The embedded interop types alleviated problems at the time of deployment. The generic covariance and contravariance give you a lot of power, but they are too academic and are probably more valued among the creators of frameworks and libraries. Optional and named arguments allow you to eliminate many method overloads and offer convenience. But none of these things alters the paradigm itself.
With version 5 of C#, Microsoft released a version with a strong focus on language innovation. This is the list of the most important features:
- Asynchronous programming with Async and Await
- Attributes Caller info
I do not want to be misunderstood. The caller info attribute is very good. It allows you to retrieve information about the context in which you are without having to resort to a lot of repetitive reflex code. I really love this functionality.
With versions 3 and 5, Microsoft had done some pretty impressive things in an object-oriented language (version 2 too, but they were copying Java concepts with those functions they introduced). With version 6 they moved away from the idea of taking a dominant star novelty and, instead, released many features to make the users of the programming language happy. Here I list a few:
- Static imports (as in Java)
- Exception filters
- Property initializers
- Members with an expression as a body
- Null Propagator
- Interpolated strings
- Name of operator
- Dictionary initializer
If we see them individually, all these characteristics of the language are very interesting. But if we value them together, we see a pattern that catches our attention. In this release, Microsoft has worked hard to eliminate repetitions in the language and make the code lighter and more legible. So for the fans of the bare and clean code, this version of the language was a great victory.
We have finally reached version 7 of C#. It is the current version on the date that this article has been written. It has very cool and revolutionary things that were already in the DNA of version 6, but without the compiler as a service. Here are the novelties of this version:
- Variables out
- Tuples and deconstruction
- Match patterns
- Local functions
- Extension of member functionality with an expression as body appeared in C# 6
- Local references and returns
All offer new capabilities so that developers can write cleaner code than ever before. Specifically, I think that Microsoft has solved problems that came from far away by condensing the declaration of variables that can be used with the keyword Out and by allowing multiple return values via tuples.
What is C# Used for
It is a program to create video games, very popular lately for all the possibilities it has. Its fame is because its engine is multiplatform, so it allows you to export video games to computers, mobile devices with Android or iOS, and different video consoles market. It is also possible to program different languages, among which is C#, thanks to MonoDevelop.
It is a software development environment for Windows operating systems. This set of tools is used to create web sites and applications, as well as generation of ASP.NET web applications, XML Web Services, desktop applications, mobile applications.