C# 判断未将对象引用设置到对象的实例,出错的代码到底在第几行

DataTable dt = null;

try
{
var x = dt.Rows.Count;
}
catch(NullReferenceException nullexception)
{
MessageBox.Show(nullexception.StackTrace);
}

猜你喜欢

转载自www.cnblogs.com/hlw422/p/12469390.html