Randomize

Richard Tallent’s occasional blog

C# 6.0 — Wish List

I was reading this blog, and had a few thoughts of my own about what should come next in C#.

1. Monadic null checking. This was #7 on the aforementioned blog. Used correctly, this could be a good time-saver.

2. VS support for columnar-aligned code. This is really a Visual Studio thing, but I really wish the IDE wouldn’t try to stop me from using tabs to align my code. I’ve been doing this ever since I learned COBOL, and probably before that. Code like this makes me happy:

switch(c) {
   case "apple":     DoAppleStuff(); break;
   case "banana":    DoBananaStuff(); break;
   case "orange":    DoOrangeStuff(); break;
   default:          DoGenericFruitStuff; break;
}

See how neat and tidy that looks? But unless I turn off code formatting entirely, VS reformats these types of formatting constantly, so I’m forever hitting Ctrl-Z to undo it. I don’t want to give up code formatting overall, just have more control over what it deems to be a format issue.

3. Support for strongly-typed RegEx and XML literal values. These data types shouldn’t have to be birthed from strings, there should be first-class scalar support for them, including Intellisense. Example:

var re = @This is a re[g]ular (expression)\. You have to escape \@ as you would " with a string. Don't use / like Perl, it is used too often and escaping it is a pain.@;
var xml = <tag><child /><child attribute="foo">XML support too, with one parent node.</tag>;

4. Pure functions. Borrowed from this blog.

5. Intrinsic support for code contracts. Strong typing is good, but contracts are better.

6. Switch…Case support for lists. I.e., “case 1, 2, 3:”.

That’s all I can think of at the moment, but I may come back later and add a few more…


Share

comments powered by Disqus