Mapping object to dictionary and vice versa

To take a dictionary and convert it to an object and vice versa: public static class ObjectExtensions { public static T ToObject(this IDictionary source) where T : class, new() { T someObject = new T(); Type someObjectType = someObject.GetType(); foreach (KeyValuePair item in source) { someObjectType.GetProperty(item.Key).SetValue(someObject, item.Value, null); } return someObject; } public static IDictionary[…]

Convert a delimited string to a dictionary

Given a string of the format “key1=value1;key2=value2;key3=value3;” how to convert this to a dictionary: var dict = text.Split(new[] {‘;’}, StringSplitOptions.RemoveEmptyEntries) .Select(part => part.Split(‘=’)) .ToDictionary(split => split[0], split => split[1]); This will fail if the assumptions aren’t met. For example, an IndexOutOfRangeException could be thrown if the text isn’t in the right format and an ArgumentException[…]

Azure Key Vault AcquireTokenAsync Deadlocked

When calling AcquireTokenAsync to retrieve KeyVault credentials the process can become deadlocked if the call is not async’d all the way down the call stack. See the following SO post for the answer as to why:

Speed up Visual Studio 2013

A number of ideas to speed up VS 2013, not sure if they work in 2015 yet: Clean the WebSiteCache folder (you may find it at C:\Users\%USERNAME%\AppData\Local\Microsoft\WebSiteCache) Clean the “Temporary ASP.NET Files” folder (find it at (C:\Windows\Microsoft.NET\Framework64\v4.0.30319) Restart Visual Studio Some links: A SO post on the subject: