你好,请问如何解决这个错误。错误 CS1525:意外的符号“命名空间”,需要“标识符”或“静态”编译失败:1 个错误

hello please how to solve this error .error CS1525: Unexpected symbol `namespace', expecting `identifier' or `static' Compilation failed: 1 error(s)

你好,我该如何解决这个错误( mcs -out:main.exe main.cs main.cs(8,6):错误 CS1525:意外的符号 namespace', expecting identifier' 或 `static' 编译失败:1 个错误,0 个警告 ) 来自这个练习(使用 + 操作将两个时间相加 写一个程序来测试 class)

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using namespace v3
    {
          public class Time
        {
          private int hr, mn, sc;
            public Time()
            {
                hr = 0;
                mn = 0;
                sc = 0;
            }
            public Time(int h, int m, int s)
            {
                hr = h;
                mn = m;
                sc = s;
            }
        
      public void display()
      {
        Console.WriteLine(hr);
        Console.WriteLine(":");
        Console.WriteLine(mn);
        Console.WriteLine(":");
        Console.WriteLine(sc);
        Console.WriteLine("\n");
      }
      public static class MembresGlobals
    {
        static int Main()
      {
      Time time_1 = new Time(3, 5, 2);
      Time time_2 = new Time(2, 5, 3);
      Time time_sum = new Time();

      time_sum.CopyFrom(time_1 + time_2);
      time_1.display();
      time_2.display();
      time_sum.display();
      }

    }
      public static Time operator + (Time ImpliedObject, Time t2)
      {
      int totalsecs = (ImpliedObject.hr * 3600) + (ImpliedObject.mn * 60) + ImpliedObject.sc + (t2.hr * 3600) + (t2.mn * 60) + t2.sc;
      int h = totalsecs / (60 * 60);
      int m = totalsecs % (60 * 60) / 60;
      int s = totalsecs % (60 * 60) % 60;
      return new Time(h, m, s);
      }
      }
    }

您不必在命名空间之前使用 using :)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace v3 {
  public class Time {
    private int hr,
    mn,
    sc;
    public Time() {
      hr = 0;
      mn = 0;
      sc = 0;
    }
    public Time(int h, int m, int s) {
      hr = h;
      mn = m;
      sc = s;
    }

    public void display() {
      Console.WriteLine(hr);
      Console.WriteLine(":");
      Console.WriteLine(mn);
      Console.WriteLine(":");
      Console.WriteLine(sc);
      Console.WriteLine("\n");
    }
    public static class MembresGlobals {
      static int Main() {
        Time time_1 = new Time(3, 5, 2);
        Time time_2 = new Time(2, 5, 3);
        Time time_sum = new Time();

        time_sum.CopyFrom(time_1 + time_2);
        time_1.display();
        time_2.display();
        time_sum.display();
      }

    }
    public static Time operator + (Time ImpliedObject, Time t2) {
      int totalsecs = (ImpliedObject.hr * 3600) + (ImpliedObject.mn * 60) + ImpliedObject.sc + (t2.hr * 3600) + (t2.mn * 60) + t2.sc;
      int h = totalsecs / (60 * 60);
      int m = totalsecs % (60 * 60) / 60;
      int s = totalsecs % (60 * 60) % 60;
      return new Time(h, m, s);
    }
  }
}

好像没有找到copyFrom方法,希望您能解决