.NET offers the simple string.Split() and string.Join() methods for joining and splitting separated strings. But what if there is no suitable separator character that may not occur in the string? Then the separator character must be escaped. And then the escape character must be escaped too… And this turns out to be quite an interesting… Continue reading String Split and Join with Escaping
Tag: Utilities
Calling Non Public Setters
Properties with non public setters sometimes make sense – until a unit test requires an object to be set up in a specific state. I don’t want to make the setter public just because of the tests, so I wrote a small helper function that can call non public setters. The helper returns the object… Continue reading Calling Non Public Setters
Updating EntitySets with LINQ2SQL
This post is written by guest blogger Albin Sunnanbo. He’s a great friend and source of inspiration and also one of the best developers I know. It was Albin that first introduced me to LINQ, EF Migrations and jQuery that I now use daily. I often find myself in situations where I need to update… Continue reading Updating EntitySets with LINQ2SQL
Debugging a WCF Service Using a 32 Bit Dll
Recently I was involved in a problem where we had a WCF service referencing a 32 bit dll. The service was set to to “Start WCF Service Host when debugging another project in the same solution”. Unfortunately that ended up with an exception. Could not load file or assembly ‘My32BitLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one… Continue reading Debugging a WCF Service Using a 32 Bit Dll
Null Handling with Extension Methods
Often we cannot be sure if a parameter passed in to a function has a value. To write error safe code all those parameters have to be checked for null and handled. We have the ?? coalesce operator to help, but still it can be quite a lot of code. Through the use of extension… Continue reading Null Handling with Extension Methods