在其他项目中使用类的静态方法 [英] using static methods of class in a different project

查看:59
本文介绍了在其他项目中使用类的静态方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,
我有一个用Visual Studio 2008编写的C#应用​​程序,它的解决方案包括几个项目.我已经在一个类的某个项目中编写了一个静态方法,并且希望在另一个项目(包含启动表单的项目)中访问此静态方法.请任何人提供任何形式的帮助.谢谢.

Hi friends,
I have a C# application written in Visual Studio 2008 and it''s solution consist of several projects. I have written a static method in a class as part of one of the projects and will want to access this static method in another project(the project containing the startup form). Please any form of help from anyone is welcome. Thank you.

推荐答案

我在这里看不到任何问题,只需添加对包含该类的项目的引用,并使用静态方法,然后像这个:
I don''t see any problem here, just add a reference to the project that contains the class with the static method and call your method like this:
MyClass.MyStaticMethod()


这篇关于在其他项目中使用类的静态方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆