Why C# Should Be Part of Your Tooling Arsenal
C# (pronounced C Sharp) is a language used in combination with Microsoft’s .NET framework for developing applications. “The open-sourced nature of C# and the framework that comes with it is pretty unique,” Mark Michaelis said during a recent interview on Code Chat. “What really makes C# powerful is that it’s strongly typed, comes with an amazing framework and is a mature language that has the ability to work across multiple platforms.”
Mark has been a regional director with Microsoft since 2007 and is also a distinguished Microsoft MVP for C# and Visual Studio Team System. As a result, he is well versed in all things C#.
Here’s Mark’s one-word definition of C# – ‘elegant-innovative-excellence.’
Let’s deconstruct it.
“Since I introduce my love for C# with a LONG ‘one-word’ description, let’s try expressing C#’s innovation in a succinct example: LINQ,” Mark said. “The invention of LINQ has revolutionized the impedance mismatch between object-oriented development and relational data. It allows developers to retrieve data from the database more easily, thereby reducing defects and rendering the code more maintainable over time.” And that’s just one example.
In Microsoft’s Introduction to LINQ (C#), the author defines a Language-Integrated Query (LINQ) as “an innovation introduced in the .NET Framework version 3.5 that bridges the gap between the world of objects and the world of data… LINQ makes a query a first-class language construct in C#. You write queries against strongly typed collections of objects by using language keywords and familiar operators.” View the full article on Microsoft docs.
Again, let’s consider just one example. “There are things you can do in C# 7 that you could never do before with the framework alone, things that the C# syntax improvements enabled,” Mark said. “Tuples are a great example where the language dovetailed with the new data type – in this case, ValueTuple. With ValueTuple, tuples can pass back and forth as first-class types and literals. This changes the way we program.”
For those new to the C# language, a tuple provides a syntax that allows you to combine the assignment of multiple variables, of varying types, in a single statement – want to know more about tuples? Check out these two MSDN Magazine articles of Mark’s – Tuples Explained and Tuple Trouble – Why C# Tuples Get to Break the Guidelines.
“Ultimately, the C# team is uncompromising on producing and maintaining excellence,” Mark said during a recent interview on DotNet Rocks! “New language features are requested all the time – especially now that it’s open source – and many of the requests are quite reasonable and compelling. However, upon review, it is often determined that there isn’t (yet) a clean way to implement the feature that the syntax is lacking. Rather than try to squash it in, the team delays, often indefinitely, until excellence is possible.”
Learn More from Mark’s Book:
The sixth edition of Essential C# 7.0 was recently released. Click to purchase. Among other things that won’t be found in previous editions, this updated version goes in-depth on the changes in C# 7.0 Tuples.
“Tuples change the way you program,” Mark said. “Sure, you can use them to return multiple values from a function, but more than that, they replace most instances where you would previously have used anonymous types – so it affects the way you use LINQ. Furthermore, tuples are strongly typed in such a way that they enable IntelliSense on the item names. This replaces almost all instances where .NET Framework 4.0’s System.Tuple might have been used in the past.”
Want to Learn More About .NET?
If you’re looking for a new language to pick up, or perhaps start a career in development, C# is a powerful tool to create well-crafted code. To learn more about the .NET framework visit the .NET website .
“The power of C# is not just in the language, although I think that’s significant, it’s also in the .NET framework that comes with it,” Mark said. Furthermore, “Now that .NET is open source, we can see its development accelerate.”
Questions about C#? Ask in the comments.
Written by Erin Wissing.