Let me take you on a journey. Let’s start with: I’m not a model builder. Some people are talked about as having two left hands….
Misc
A Bit Unhappy About 2018’s Calendars
For quite a number of years now I have had television and movie-themed calendars on my walls. Mostly about TV shows I enjoyed at the…
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 the new syntax features.
Below the video on Youtube – but here as well – you’ll find the time indices at which a new feature begins:
Windows 10: Disable the Language Bar in the Taskbar
Windows 10, like other Windowses before it, bring the language bar with it. My Windows UI is in English by default but I prefer my…
Yield return & using IDisposable
“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) { Console.WriteLine(color.Name); } Console.ReadLine(); } static IEnumerable<Color> Rainbow { get { yield return (Color.Red); yield return (Color.Orange); yield return (Color.Yellow); yield return (Color.Green); yield return (Color.LightBlue); yield return (Color.Indigo); yield return (Color.Violet); } } }
Red Orange Yellow Green LightBlue Indigo Violet
The .NET compiler then creates the necessary IEnumerable- and IEnumerator-implementing classes and the state machine in the background and everything is fine and clear.
Read more
Linq: Split()
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)); var odds = list.Where(number => ((number % 2) != 0));
But it does not have a solution for both. So I wrote myself one:
public static void Split<T>(this IEnumerable<T> source , Func<T, Boolean> predicate , out IEnumerable<T> trueList , out IEnumerable<T> falseList) { trueList = source.Where(predicate); falseList = source.Except(trueList); }
WPF: MVVM & Responsive UI
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 entire GUi after every single user action.
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…