Useful code snippets in CSharp