Beauty of C#

As much as i love JavaScript I adore C#. I've dabbled in C, Python and Java and i use HTML, CSS and SQL all the time but it wasn't until recently that i devoted time to learning and using C#, Microsoft's flagship .NET language.

I'm beyond pleasantly surprised, C# is a wonderful mix of imperative and functional programming paradigms, offering a highly powerful set of features that give the programmer multiple avenues through which to solve a problem. Pile on top of this the support for generics and the vast .NET library and there's little that C# can't do. 

Take for example the support for lambda expressions and delegates. These tools both offer the ability to define, assign and return anonymous functions. Anonymous functions are, on the surface, functions without a name, which can be assigned to a variable or returned from a function. Essentially, anonymous function enable first class functions, that is functions can be assigned to variables, used as function params or returned from functions just like any other value. 

The real power of first class functions comes in the creation of a closure. Closures consist of functions inside of other functions that keep the outer function's variables in scope for as long as a reference to the inner function is maintained. This means that the stored inner function can remember vales in the outer function across functions calls preserving the state of the captured variables indefinitely.

The object-oriented side of C# is quite robust with classes, interfaces, single-inheritance, and 100% OOP design which is to say that everything resides in a class. Unlike in C++, there is no support for functions living outside of a class. There are also no true global variables, which is of course a good thing! Instead you can declare a public static class with a public static property that other classes can easily access. 

I personally place C# at the top of Microsoft's achievements, hence i thought of publishing in-depth c# capabilities in future blog posts


Comments

Popular posts from this blog

Dependency Injection in ASP.NET MVC 5 with StructureMap

Real-time web with Node.js & Socket.io

First Look at AngularJS 2.0