标签:初始化 [] send load protect obj end new 赋值
protected void Page_Load(object sender, EventArgs e)
{
string[] A;
if (B== 0)
{
A = new string[] {1,2,3,4,5 };
}
funD(A);
}
这样会在funD(A);报错,使用了未赋值的局部变量“A"
要这样
protected void Page_Load(object sender, EventArgs e)
{
string[] A = null;
if (B== 0)
{
A = new string[] {1,2,3,4,5 };
}
funD(A);
}
标签:初始化 [] send load protect obj end new 赋值
原文地址:http://www.cnblogs.com/suxiaBlogs/p/7243203.html