1
儘管我已經構建了一個類並在下面的客戶端程序中引用了它,但使用時卻遇到了令人討厭的問題,編譯器需要我的方法的完全限定名。C#Net類引用類庫:爲什麼我必須完全限定一個公共類?
// this doesn't compile because it does not recognize the Decrypt method
using PGPEncryptDecrypt.Helpers.PGP;
namespace TestComInterOpPGP
{
class Program
{
static void Main(string[] args)
{
PGPEncryptDecrypt.Decrypt(@"C:\Users\blah.pgp",
@"C:\Users\secring.gpg",
"pwd",
@"C:\Users\out.txt");
}
}
}
必須完全限定
// this does compile
using PGPEncryptDecrypt.Helpers.PGP;
namespace TestComInterOpPGP
{
class Program
{
static void Main(string[] args)
{
PGPEncryptDecrypt.Helpers.PGP.PGPEncryptDecrypt.Decrypt(@"C:\Users\blah.pgp",
@"C:\Users\secring.gpg",
"pwd",
@"C:\Users\out.txt");
}
}
}