In
C# v7.3 (not 8.0), I'm looking for a solution for the following desired design:
Right now I'm not sure between implementation of an Interface or an Abstract class (at the moment this is not the subject of the discussion)
but my desired goal is to call the method explicitly:
Let's say I have 2 Interfaces:
public interface IDirectory
{
object Get(string name);
}
public interface IFile
{
object Get(string name);
}
And a class (which should implement the methods in the Interfaces):
public class StorageAccount : IDirectory, IFile
{
}
I want to be able to call the methods in the following way when creating the StorageAccount instance:
StorageAccount sa = new StorageAccount();
var res1 = sa.IFile.Get("something");
var res2 = sa.IDirectory.Get("something");
Alternatively, if it can be implemented using an abstract class, this is also an option for me:
public abstract class BaseStorageAccount : Directory
{
}
public class Directory : File
{
public virtual object Get(string name)
{
return null;
}
}
public class File
{
public virtual object Get(string name)
{
return null;
}
}
Is this doable?
What I have tried:
..........................................