String.Interpolation – C# 6

One of the new, and probably very unused capabilities of C# 6, is String Interpolation. Ok, that’s not really a new concept. We’ve seen it with String.Format() and the ideologically wrong String.Concat() methods.

Hell, we’ve probably all (at some point in our lives) done [string + ” ” + string] and made it work. Of course, not going into why that’s completely wrong, lets assume we’ve been using the String.Format() method most..

 internal static string ReturnValue(TestObject x, TestObject y)
    var orgExpression = String.Format("{0} in the year {1}", x.Name, y.Year);
    return orgExpression;

Of course, a very simplistic design – but it shows the string interpolation (e.g. loosely translated [the method of which one point of data is created out of multiple points of data]).

With C# 6 we’re seeing something a bit niftier (and dare say I…neater?)

 internal static string NewMethod(TestObject x, TestObject y)
     var newExpression = $"{x.Name} in the year {y.Year}";
     return newExpression;

The biggest hassle with String.Format(); well aside from the fact that it’s somewhat error prone if you started to get a bit complex; you see, the order of the parameters are extremely important. Getting too smart here could get you into some serious trouble.

Plus, the new way of doing this is a lot more readable (read: maintainable)..

As in the “old” days with String.Format() we can still use format expressions.

internal static string NewMethod2(TestObject x, TestObject y)
   var newExpression = $"{x.Name} in the year {y.Year:D4}";
   return newExpression;

We can even use conditional expressions if we need to.

internal static string NewMethod3(TestObject x, TestObject y)
   var newExpression = $"{x.Name} in the year {(y.Year < 1 ? "AD 0" : "AD 2015")}";
   return newExpression;

I for one am very happy with the development of C# these days.

Have fun, stay safe and keep coding.




LIDNUG Global Windows 8 Code Jam

Stock up on coffee, niblies and sleep – because you’re going to be needing it!!

LIDNUG has teamed up with InnerWorkings and are going to be running a Global Code Jam, from the 12-June-2013 till the 12-July-2013. This is Your chance to see how you stack up with developers from all over the world and an opportunity for you to win some great prizes from InnerWorkings, Telerik, Submain, Syncfusion and many more…

So how do you get on board and start crunching some code? Simple, follow these steps and you just can’t go wrong.

Head on over to and register:

step 1

Then you need to create an account – it’s painless, just need to enter in some details and click “Register”

step 2After registering you’ll just need to run the InnerWorkings Developer Interface installer..

step 3step 4

Start up the InnerWorkings Developer Interface and log in with the credentials you just used to register with.

step 5

step 5.0

Once you’ve logged in, the first order of business is for the Visual Studio project solution files to download.

step 5.2

Once that’s done it’s time to join the competition. Go to the “Achievements” tab.

step 6

Then click on the “Competitions” tab, inside the “Achievements” area.

step 7

Then select the country you wish to represent and click “Join Team”.

step 8

That’s it – you’re ready to get started. Click on the “Windows 8 app Development with C# and XAML” link on the left hand side under “Installed Content”.

After than it’s just about getting your hands dirty..Launch the project code…Click on the first task (or whichever task you’re at), then click on “Challenge”.

step 9

In the Challenge tab you’ll see two buttons..

One which is the “Launch Project Code” option – this launches Visual Studio 2012 and opens up the solution for the task. The other is “Judge Project Code” which is used to “Submit” your solution to the competition.

Beware, the more times you go submit, the lower score you’ll get. Same goes for using any of the “Help” features around.

step 10

Once Visual Studio is running you’ll be presented with the “Challenge” details. Follow the instructions and go through the details carefully. The “Judge Project Code” feature is also available inside Visual Studio as the InnerWorkings Developer Interface integrates straight into Visual Studio – nifty.

Step 11

That’s pretty much how you get started with the competition.

Each week we’ll be releasing more and more challenges – defeat them all and become the code guru that you want to be!

We will also pick weekly winners, so the more challenges you complete, the more likely it is that you’ll win.

Also, don’t forget to register with LIDNUG ( as you can only win any of the prizes if you’re a LIDNUG member. That’s free too btw.

So, good luck and happy coding!

LIDNUG & Scott Guthrie – 15th Q&A on the 9th of January



LIDNUG presents Scott Guthrie’s 15th Open Q&A and the first event of 2013.


Scott has been coming back to LIDNUGs members each quarter for the past couple of years and it’s been one of the best sessions to get answers directly from The Gu himself.


In this session Scott answers questions on technical solutions, advices on implementations and draws comparisons between methodologies – all in the span of 90 minutes where his sole focus is to answer whatever question that comes in from the attendees.


My name is Scott Guthrie, and I am a Corporate Vice President in the Microsoft Server and Tools Business. I run a development team that works on the following products/technologies:scott-guthrie

  • Windows Azure
  • Entity Framework
  • WCF
  • WF
  • IIS
  • Service Bus
  • Cache
  • BizTalk
  • Visual Studio Tools for Web
  • Web Services and Workflow

Register and attend this event for a chance to win 1 of 2 Telerik Ultimate .Net Collections.

Click here to register



Where can I contact the organizer with any questions?
Use the following link and send us a question

Is there sufficient parking available at the venue?
Yes, parking is available at this Virtual Online Event. Just make sure you park the car in your drive-way, have a cup of coffee and log in.

Who can I blame if I can’t access the session?
Just blame Brian (it’s easier that way) =>

Will attending this event help my career prospects?
Of course, you will be able to bring a treasure trove of knowledge with you to your next job interview.


LIDNUG and Wintellect Presents – .NET Performance Tuning with John Robbins

LIDNUG & Wintellect Presents – .NET Performance Tuning with John Robbins    John Robbins

One of our most highly anticipated events and presenters is coming up in just a few days (11th of October, 2012) – namely the return of John Robbins. Last time we caught up with John we had a full house, and with currently 700+ registered to attend it’s bound to be a blast.

.NET is an amazing environment. It runs on everything from a small phone in your hand, to the latest touch tablet, to your company’s server, to a cloud environment handling tens of thousands of transactions per second. But with that flexibility comes problems. When your applications performance slows down the issues go from “working OK” to “we are going to get fired any minute” literally overnight. You’ve got a performance problem with your .NET code so what the heck do you do?   In this session John Robbins will talk about the wonderful tools you have to find and fix those performance issues once and for all. There’s a lot of deep thinking over performance that most developers haven’t done because they don’t need to do it every day. Fortunately, John’s done that thinking for you so join him for this session and learn to tackle .NET performance problems. No matter if your performance problem is algorithmic or memory-based you’ll see how to deal with those issues once and for all.

Register to attend the webinar and you’ll be entered to win a Wintellect virtual training course (a $499 value). The winner will be announced during the webinar. You must be present to win.

The LIDNUG and Wintellect series of events are sponsored by Syncfusion.

For more details and to register, click here:

note: for those on the southern hemisphere please be aware that this event is held in the EDT timezone.

Simple way to deserialize DateTime strings

I recently came across a small problem when i was debugging an application. The app relied on a REST service and returned an XML result to me. An addition to the returned XML was that of a “start_date” element. Since we initially didn’t need to actually “do” anything with the “start_date” element, it was simply written out in pure text.

Later on, it suddenly became obvious that we needed to actually “do” something with it, so we needed to deserialize the element returned, and convert it into a DateTime object.

Now that’s not possible to do normally with the returned element..

1: <elements>
2: <otherelement />
3: …..
4: <start_date>2012-01-16 10:00:00</start_date>
5: …..
6: </elements>
The opposing definition for the “start_date” element – especially since the format was a bit off as well (US format).
1: [XmlElement(“start_date”)]
2: public stringStartDateString { get; set; }The solution is to have another property listed in
the deserialization class, which would take care of the conversion for us.
1: [XmlIgnore]
2: public DateTime StartDate
3: {
4: get { return DateTime.Parse(StartDateString, CultureInfo.InvariantCulture); }
5: }
First and foremost you decorate the “StartDate” property with [XmlIgnore] so that it doesn’t get deserialized – then it’s as simple as referencing the “StartDate” property as opposed to the “start_date” property when dealing with it.