c # implementation