有两种形式.Form2源自Form1.
但是我在设计模式下遇到了Form2的问题,如下面的屏幕截图所示.
如果我对此发表评论this._presenter.Retrive();,它将正常工作.是怎么回事以及如何解决这个问题?
UPD: 如果我将删除throw new NotImplementedException(); 并将插入,例如,MessageBox.Show("Test");,每次我打开Form2时,MessageBox都会出现,就像我运行应用程序一样.
窗体2
namespace InheritanceDemo
{
public partial class Form2 : Form1
{
public Form2()
{
InitializeComponent();
}
}
}
Run Code Online (Sandbox Code Playgroud)
Form1中
namespace InheritanceDemo
{
public partial class Form1 : Form
{
protected IPresenter _presenter;
public Form1()
{
InitializeComponent();
_presenter = new Presenters();
}
private void Form1_Load(object sender, EventArgs e)
{
this._presenter.Retrive();
}
}
public class Presenters : IPresenter
{
public void Retrive()
{
throw new NotImplementedException(); …Run Code Online (Sandbox Code Playgroud) 如何在C#中以编程方式检索主Dns后缀?
Run Code Online (Sandbox Code Playgroud)C:\Users\jdoe>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : ABC-PC --->Primary Dns Suffix . . . . . . . : mdanshin.co.za<--- Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . …
我有一个大文本。我需要在文本中找到任何单词,然后将包含该单词的短语复制到变量中。我怎样才能用 C# 做到这一点?也许我可以使用一些正则表达式?