how did you implement the interface? if you implement the interface this way:class TestInt : IEncryptable { public void Encrypt() {Console.WriteLine("Encrypt");} public void Decrypt() {Console.WriteLine("Decrypt");} //.... } then you call them directly:TestInt doc = new TestInt(); doc.Encrypt(); doc.Decrypt();if you implement the interface this way:class TestInt : IEncryptable { void IEncryptable.Encrypt() {Console.WriteLine("Encrypt");} void IEncryptable.Decrypt() {Console.WriteLine("Decrypt");} //.... }then you have to do a cast before call its methods: TestInt doc = new TestInt(); IEncryptable ie = doc as IEncryptable; ie.Encrypt(); ie.Decrypt(); it is called Explicit Interface Implementation, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkexplicitinterfaceimplementationtutorial.asp"... When a member is explicitly implemented, it cannot be accessed through a class instance, but only through an instance of the interface ..."
{
public void Encrypt() {Console.WriteLine("Encrypt");}
public void Decrypt() {Console.WriteLine("Decrypt");}
//....
}
then you call them directly:TestInt doc = new TestInt();
doc.Encrypt();
doc.Decrypt();if you implement the interface this way:class TestInt : IEncryptable
{
void IEncryptable.Encrypt() {Console.WriteLine("Encrypt");}
void IEncryptable.Decrypt() {Console.WriteLine("Decrypt");}
//....
}then you have to do a cast before call its methods: TestInt doc = new TestInt();
IEncryptable ie = doc as IEncryptable;
ie.Encrypt();
ie.Decrypt();
it is called Explicit Interface Implementation, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkexplicitinterfaceimplementationtutorial.asp"...
When a member is explicitly implemented, it cannot be accessed through a class instance, but only through an instance of the interface
..."