PBMe_HikeIt
PBMe_HikeIt

Reputation: 679

C# Net Class referenced class library: why must I fully qualify a public class?

Having an annoying issue where though I've built a class and referenced it in a client program like below - with the using, the compiler wants the fully qualified name of my method.

// 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");

    }
}
}

must fully qualify

// 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");

    }
}
}

Upvotes: 1

Views: 126

Answers (1)

PBMe_HikeIt
PBMe_HikeIt

Reputation: 679

Ahh - while typing this I realized that the problem was that the Class PGPEncryptDecrypt had the same name as the first part of the namespace. So I just changed one or the other and don't need to fully qualify. Perhaps this'll help someone!

Upvotes: 2

Related Questions