The New C# 6.0 Language Features Explained

I am a professional and passionate software developer and have been using the Microsoft :NET platform for more than a decade now. A few months ago the new C# compiler was released which supports the new language version C# 6.0. The following video which I recorded “wiff ze German English accent” I explain some of…

Yield return & using IDisposable

Deutsche Version “Yield return” is a powerful and handy statement if you want to quickly and easily an iteratable list without creating an Array or a List first: using System; using System.Collections.Generic; using System.Drawing; class Program { static void Main() { var colors = Rainbow; Console.WriteLine(“colors.GetType(): {0}”, colors.GetType()); Console.WriteLine(); foreach (Color color in colors) {…

Linq: Split()

Deutsche Version So you know the Cinderella saying “The good ones go into the pot, the bad ones go into your crop.”? Well, .NET Linq does have a solution for either one, it’s called Where(). If you use that, your solution probably looks like this: var evens = list.Where(number => ((number % 2) == 0));…

WPF: MVVM & Responsive UI

Deutsche Version A few days ago I wrote about my first tumbling steps into the world of WPF & MVVM. Now a friend of mine – who’s been working in that very field – has challlenged me: a) My GUI should remain responsive while the merge is being executed. b) I should not re-evaluate the…

WPF: MVVM, ViewModel, Model & MessageBoxes

Deutsche Version I’ve never been much of a GUI developer and my programs look it. Where I’m good at is the Businesslogic part of the application. That’s why I’ve always stuck to known territory, where you can align controls along lines and it looked halfway decent (though not pretty). But times they are a-Changin’ and…

My GetService Pattern

In .Net the Interface System.IServiceProvider is a simple and elegant method to query services from other objects without having – or even wanting – to know how the class structure behind it looks like. Is the interface at that class implemented or at another? No matter, you query IServiceProvider and you get an instance of…

My XmlSerializer Pattern

The idea behind the .NET System.Xml.Serialization.XmlSerializer class is that you can easily serialize an XML file into a class tree and vice versa. If you’re using XML Schema files, the xsd.exe tool can create that class tree for you. But for simple applications you don’t even need a schema. You simply create a class that…

C# CodeDom Inline Compiling

I was a bit bored just now and since the WYSIWYG editor of WordPress 2.9.2 doesn’t work as optimal as I had hoped, I decided to write my own program that translates forum posts with BB code into HTML. Of course I could have put all these replace functions into the code but then I…