定义引用类型变量型时,初始化null和不初始化,这两种情况对于一个程序的性能什么的有没有影响?如:
public partial class Form2 : Form
{
private FileStream fs;
private FileStream fs2=null;
}这两种方式,对程序,系统性能有没有什么影响的?
public partial class Form2 : Form
{
private FileStream fs;
private FileStream fs2=null;
}这两种方式,对程序,系统性能有没有什么影响的?
按你的说明,如果定义完不赋值就使用会报错 private void a()
{
FileStream fs;
if (fs==null) //CE{0}: Use of unassigned local variable '{1}'
{ }
}
好, 还真没试过, 总是 = null了