first pass at C# version