You can do it in a very simple way, but do it over, again and again. Or, you can do it in a very universal way.
Nearly everyone knows the simple way, but, to best of my knowledge, the universal way is happened to be only mine. It's is very exotic but fully legitimate and reliable, as it is totally based on standard .NET library (that is, BCL). I discuss both in my article. Please see:
Wish You Were Here… Only Once