Misc tool codes for C#