C sharp implementation of GFM