While trying to answer another question, I was serializing a C# object to an XML string. It was surprisingly hard; this was the shortest code snippet I could come up with:<
Write an extension method or a wrapper class/function to encapsulate the snippet.