How to use class from other files in C# with visual studio?

前端 未结 6 930
孤独总比滥情好
孤独总比滥情好 2020-12-29 04:51

I am a newbie of C# and MS visual studio, and I want to use the C# class which defined in another file, but can\'t get it work.

Here is the program.cs

6条回答
  •  爱一瞬间的悲伤
    2020-12-29 05:16

    I was having the same problem here. Found out that the problem was with an Advanced Property of the file. There is there an option with the name 'Compilation Action' (may be not with the exact words, I am translating - my VS is in Portuguese).

    My Class1.cs file was there as "Content" and I just had to change it to "Compile" to make it work, and have the classes recognized by the others files in the same project.

提交回复
热议问题