I am not sure what this is called so I most likely calling it wrong when I say Inherited interface. Here is what I am trying to achieve.
I have an interface like this
public interface INotificationEngine
{
bool UsingDbMail();
bool UsingSMTP();
bool UsingSMS();
}
My class looks like this
public class NotificationEngine
{
public class Send : INotificationEngine
{
public bool UsingDbMail(string para)
{
throw new NotImplementedException();
}
public bool UsingSMTP()
{
throw new NotImplementedException();
}
public bool UsingSMS()
{
throw new NotImplementedException();
}
}
}
That allows me to do something like the following
NotificationEngine.Send sendRequest = new NotificationEngine.Send();
sendRequest.UsingDbMail("hello");
What I want to achieve instead is the following
NotificationEngine engine = new NotificationEngine();
engine.UsingDbMail("hello").Send;
Any idea how can I do that with interfaces or any other way?
UsingDbMail()is returning abool, and a boolean value does not have the propertySend. Please edit your question to include a detailed description of what you are trying to do.engine.UsingDbMail("hello").Send();(a method namedSendon an object returned by theUsingSomethingmethods); have an interface with theSendmember exposed, and have yourUsingXyzmethods return an object that implements this interface.public IMailerService UsingDbMail(string body), and then have aclass DbMailerService : IMailerServiceand then you'll have aSmtpMailerService : IMailerService, and so on.