CSharp support copied from Padre