a series of C# code for simple use