Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Inherit from Interface only if dll is available

I have a class that is supposed to inherit from an interface only if the *.dll-file of the interface is available.

Example:

"commandInterface.dll" contains following interface:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

public interface ICommand
{
    string GetName();
    string Run(string[] args);
}

"main.exe" contains following class:

public class TestCommand : ICommand
{
    public string GetName()
    {
        return "test";
    }
    
    public string Run(string[] args)
    {
        return args[0];
    }
}

That works if both files are in the same directory. Is there any way to run "main.exe" even if "commandInterface.dll" is missing? So that the class is still there, only that it no longer inherits from the interface?

>Solution :

No. If the interface is missing, this won’t work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading