Answer the question
In order to leave comments, you need to log in
Change of interface implementation without project recompilation. How to implement?
Good afternoon. How can you replace the implementation of the functionality in the finished program?
I'll give you an example. I have an interface:
public interface IMessage
{
string GetMessage();
}
public class Message : IMessage
{
public string GetMessage()
{
return "Hello From Message Class";
}
}
public partial class Form1 : Form
{
private readonly IMessage m;
public Form1()
{
InitializeComponent();
m = new Message();
}
private void Clickbtn_Click(object sender, EventArgs e)
{
MessageBox.Show(m.GetMessage());
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question