如何使用参考? [英] How to use reference?

查看:90
本文介绍了如何使用参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我使用的是C#

我制作了一些图层项目(BLL,MDL,PL,DAL)

在PL我添加了对BLL的引用。

如何从BLL请求方法?

BBL.Method不起作用

Hello! I use windows froms C#
I made some layers projects (BLL, MDL, PL, DAL)
At PL I added reference to BLL.
How to request method from BLL now?
BBL.Method does not work

推荐答案

你好Junoli,



为了从BLL访问方法,你需要为BLL中的类创建对象。

如下所示

Hi Junoli,

In order to access methods from BLL, you need to create object for the classes in BLL.
Like below
BLL objBLL = new BLL();
objBLL.YourBLLMethod_Name();



如果你的BLL包含任何静态类,那么你可以直接调用那些带有类名的类中的方法。

如下所示


If your BLL contains any static classes then directly you can call the methods in those classes with class name.
Like below

BLL.YourBLLMethod_Name();



快乐编码。



问候,

Manoj


Happy coding.

Regards,
Manoj


HI,



如果您的图层位于同一个项目中,那么您可以在使用部分中包含文件夹结构,然后就可以访问该类中定义的对象和方法。



如果你有不同的结构项目,那么只有在所需项目中包含dll并在那里创建对象之后才能访问这些方法。





If your layers are in the same project then you can include the folder structure in the Using section and then can able to access the object and methods defined there in the class.

If you are having the different projects for the structure then you can able to access the methods only after including the dlls in the required project and creating the object there as mentioned.

BLL BLLObject = new BLL();
BLLObject.MethodName();





谢谢



Thanks





在项目中添加引用时,可以在项目中访问所有程序集名称空间/类/接口。如果是命名空间类,则需要在头类文件中导入命名空间。



在项目中上课后,您可以创建课程实例并使用该功能。



希望这些信息可以帮助您,
Hi,

When you are adding reference in your project, all the assembly namespace/classes/interfaces will be accessible in your project. In case of namespace classes you need to import namespace in the header class file.

After getting class in your project you can create instance of your class and use the function.

Hope this information helps you,


这篇关于如何使用参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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