C#

int i:默认;

class add(int i){

i=2;

}

1.ref 、out、默认的 有什么区别

(1)ref 和out与默认 区别:在与 能接受返回的变量值

(2)ref 和 out 区别:out 所修饰的变量可以不用赋值,而 默认的和ref 需要

2.计算性能

static void jsTime()
{
Stopwatch sw = new Stopwatch();
sw.Start();
//耗时巨大的代码
sw.Stop();
TimeSpan ts2 = sw.Elapsed;
Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);
}

猜你喜欢

转载自www.cnblogs.com/lp73/p/7494166.html
C#