using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dlltest;
namespace yindlltest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int a, b,c;
a = Convert.ToInt32(this.textBox1.Text);
b = Convert.ToInt32(this.textBox2.Text);
c = Class1.sum(a, b);
this.label3.Text = c.ToString();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace dlltest
{
public class Class1
{
public static int sum(int i, int j)
{
return i + j;
}
}
}
把一些共同的方法编译到dll中,这样可以屏蔽一些代码。