无法将此 Pascal 代码转换为 C#

Unable to convert this Pascal code to C#

我不知道Pascal,这就是我问的原因。 也许它创建了文件并在那里写了一些东西 有帕斯卡代码

Program WriteFile;
Uses Crt;
Var Dur,ts,tv,n,vers,i : integer;
    X,FileName : String[12];
    f : file of integer;
begin
  ClrScr;
  Write('Variant=');
  Readln(vers);
  Write('Number of works='); 
  Readln(n);
  Str(vers,X);
  FileName:='Shed'+X+'.tab';
  Assign(f,FileName); 
  Rewrite(f);
  For i:=1 to n do
    begin Writeln(i,'-th work:');
    Write('time of beginning=');
    Readln(ts);
    Write('during='); 
    Readln(Dur);
    tv:=ts+Dur;
    Write(f,ts,Dur,tv)
    end;
  Close(f)
end.

我觉得会是这样的:

static void Main(string[] args)
    {
        Console.Clear(); //unnecessary
        Console.Write("Variant=");
            int vers = Int32.Parse(Console.ReadLine());
        Console.Write("Number of works=");
            int n = Int32.Parse(Console.ReadLine());

        string X = vers.ToString();
        string FileName = "Shed" + X + ".tab";
        //or string FileName = "Shed" + vers.ToString() + ".tab"; //without unnecessary X variable

        System.IO.File.WriteAllText(FileName, string.Empty); //clear file

        System.IO.StreamWriter file = new System.IO.StreamWriter(FileName);
        int ts;
        int dur;
        int tv;

        for (int i = 0; i < n; i++)
        {
            Console.WriteLine(i.ToString() + "-th work:");
            Console.Write("time of beginning=");
            ts = Int32.Parse(Console.ReadLine());
            Console.Write("during=");
            dur = Int32.Parse(Console.ReadLine());
            tv = ts + dur;

            file.WriteLine(ts.ToString() + "\t" + dur.ToString() + "\t" + tv.ToString());
        }

        file.Close();
    }