总体结构
Class1的内容
using System.Windows.Forms;
namespace demo1
{
internal class Class1
{
public class HelperClass
{
public void DoSomething()
{
MessageBox.Show("Doing something useful...");
}
}
}
}
Class2的内容
using System.Windows.Forms;
namespace demo1
{
internal class Class2
{
public class HelperClass2
{
public void DoSomething2()
{
MessageBox.Show("Doing something useful...");
}
}
}
}
界面上放一个按键
using System;
using System.Windows.Forms;
using static demo1.Class1;
namespace demo1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
HelperClass helper1 = new HelperClass();
helper1.DoSomething();
Class2.HelperClass2 helper2 = new Class2.HelperClass2();
helper2.DoSomething2();
}
}
}