js code convert to Csharp