[英]C# DLL does not expose methods
我正在處理未創建的C#項目。 我把它剝下來了。
我以為我做的一切正確。 它編譯良好,我可以在VB.NET應用程序中引用DLL並使用它。
但是,不會公開DLL的方法。
有人可以立即告訴我他是否出了問題?
我認為這是DLL的重要組成部分:
using System;
using System.Collections;
using System.Data;
using System.Reflection;
using System.Text;
using SevenZip.Compression.LZMA;
namespace SevenZipControl
{
public static class Zipper
{
public static bool compressBytes(byte[] InputBytes,out byte[] OutputBytes)
{
OutputBytes=SevenZipHelper.Compress(InputBytes);
return true;
}
public static bool decompressBytes(byte[] InputBytes, out byte[] OutputBytes)
{
OutputBytes = SevenZipHelper.Decompress(InputBytes);
return true;
}
}
}
這就是我在VB.NET中使用它的方式:
Dim c As SevenZipControl.Zipper
c. (...)
但是我的函數“ compressBytes”和“ decompressBytes”不可用,因為可以在此屏幕截圖中看到:
您的代碼列出了靜態方法。 您正在創建SevenZipControl.Zipper
類的實例。
要搭載@JAnderson的答案,您無需使用Dim
實例化。 以下應該工作:
SevenZipControl.Zipper.compressBytes(data)
有關靜態類的概念如何轉換為VB的一些信息,請參見此討論。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.