c#中的引用问题1

网友投稿 610 2022-12-02

c#中的引用问题1

c#中的引用问题1

首先创建一个从文件b.cs:

using System;namespace superdont{ class testprint { public void print() { Console.Write("lilizong"); } }}

其次创建一个主文件a.bs,引用从文件的命名空间中的类的方法

using System;using superdont;namespace lilizong{ class test { public static void Main() { testprint a = new testprint(); a.print(); } }}

此时如果直接编译csc a.cs会导致错误,提示无法找到命名空间“superdont"。 正确的编译方式为,将主文件和从文件放到一起进行编译。 为:csc a.cs b.cs,然后运行a。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:委托委托,谁委托谁?
下一篇:asp.net mvc 里的Url.Action与Url.RenderAction
相关文章

 发表评论

暂时没有评论,来抢沙发吧~