C# class without main method

后端 未结 10 615
情话喂你
情话喂你 2021-01-02 02:44

I\'m learning C# and I\'m very new to it, so forgive me for the seemingly stupid question. I have some experience in Java, and I noticed that C# programs also need a m

10条回答
  •  醉酒成梦
    2021-01-02 03:13

    Try using /t:library switch with the compiler. By default it tries to make an .exe which, of course, needs an entry point (i.e. a main method). If you compile to a .dll you won't need that.

    But as HighCore suggested, if you are learning, just use Visual Studio (download one of the free versions if you haven't already) and let it worry about the compiler flags.

提交回复
热议问题