如何从方法中写入该文件的DLL库文件中读取数据? [英] How do I read data from a DLL library file that ive written to that file in a method?

查看:169
本文介绍了如何从方法中写入该文件的DLL库文件中读取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在dll库文件中写了一个方法,如下所示



public void writeLog()

{

CodeHelper.CMiscHelper.WriteLog(新例外(1),CodeHelper.CMiscHelper.ELoggingOption.File);



}



这个方法假设将以下字符串写入dll文件:1。

我想要做的是读取字符串1当我点击一个名为加载DLL:的按钮时,从Windows窗体项目中的那个DLL。窗户形式是一种新的溶剂或同样无关紧要。 1可以出现在文本框中或任何无关紧要的内容。

dll文件的名称是dllNumber





一些帮助将非常感谢!!



我尝试过:



我试图引用我在Windows窗体中创建的dll文件。我使用dllNumber添加了程序集;

我在windows窗体sollution中添加了dll库项目。

我还在窗体上的按钮中实例化了dll库类。

我尝试调用该方法,但似乎无法工作。

Ive written a method in a dll library file that looks as follow

public void writeLog()
{
CodeHelper.CMiscHelper.WriteLog(new Exception("1"), CodeHelper.CMiscHelper.ELoggingOption.File);

}

This method is suppose to write the the following string to to the dll file :"1".
What i want to do is read the string "1" from that dll in a windows form project when i click a button named "Load dll:". The windows form is an intirely new sollution or same doesnt matter. The "1" can appear in a text box or anything that also doesnt matter.
The name of the dll file is dllNumber


Some help will be very much appreciated!!

What I have tried:

ive tried to reference that dll file that i created in my windows form. and i added the assembly using dllNumber;
I have added the dll library project in my windows form sollution.
I also instantiated the dll library class in my button on the form.
and i tried calling the method but it seems not to work.

推荐答案

您显示的代码使用名为 WriteLog 输出 - 大概是一个日志文件,但是存储日志的地方我们不知道。

使用Visual Studio查看是否可以找到方法的定义:右键单击代码中的方法名称,然后选择转到定义。如果源代码可用,它将带您进入它,如果没有,它将转到内部生成的元文件,该元文件在同一名称空间中列出函数原型。这将至少列出任何其他方法,因此您可能会发现有一个可以使用的ReadLog。

如果没有,请回到您的大四,并索取相应的文档/源代码。
The code you show uses a static method called WriteLog to output - presumably to a log file, but where the log is stored we have no idea.
Use Visual Studio to see if you can find the definition of the method: right click the method name in your code and select "Go To definition". If the source code is available, it will take you to it, if not, it will go to an internally generate metafile which lists function prototypes in the same namespace. That will at least list any other methods, so you may find there is a ReadLog you can use.
If not, go back to your senior and ask for the appropriate documentation / source code.


这篇关于如何从方法中写入该文件的DLL库文件中读取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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