1、先在VS里边创建一个类库(.Net Framework)(是2哦)
2、在项目里边添加你需要的内容
例如
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassLibrary2
{
public class Class1
{
public decimal Add(decimal x, decimal y)
{
long timer = System.DateTime.Now.Ticks;
int k = 0;
for (int i = 0; i < 100000000; i++)
{
k++;
}
long timer1 = System.DateTime.Now.Ticks;
Console.WriteLine(timer1 - timer);
return timer1 - timer;