c# version added

Tried to stay in the original intent of the Java code and resist
refactoring :)
Let me know if anything is unclear or if you need anything more or different.