一个解决方案中来自不同项目的调用方法 [英] Calling methods from different Projects in one Solution

查看:55
本文介绍了一个解决方案中来自不同项目的调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1个解决方案中有3个项目.我从第一个项目的主文件中进行的主要操作.但是我需要调用方法并使用3rd Project中的类.例如:

There are 3 Projects in 1 Solution. Main manipulations I make from the main file in the 1st Project. However I need to call methods and use classes from the 3rd Project. For example:

–第三项目具有:

– 3rd Project has:

public DataClasses1DataContext() :     base(global::WindowsFormsApplication1.Properties.Settings.Default.mediaBorshchConnectionString, mappingSource)
 { OnCreated(); } 

从我的第一个项目中调用它的正确方法是什么?

What is the right way to call it from my 1st Project?

DataClasses1DataContext borshch = new DataClasses1DataContext()

推荐答案

您需要在第一个项目中添加对第三个项目的引用.为此,右键单击您的项目,选择添加引用",然后在解决方案中选择该项目.一旦您的主项目引用了第三个项目,您就可以访问其公共类型.

You need to add a reference to the 3rd project in your 1st project. To do this, right-click on your project, select "Add Reference," then select the project in your solution. Once your main project references the 3rd project, then you can access its public types.

这篇关于一个解决方案中来自不同项目的调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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