我有一个代码:
string[] sizes = new string[] {"1","11","2","22","200","222", null, "105", "101", "102", "103", "90" };
try
{
var size = from x in sizes
orderby x.Length, x
select x;
foreach (var p in size)
{
Console.WriteLine(p);
}
Console.Read();
}
catch (NullReferenceException)
{
}
如何在 x.Length 中捕获 null,并继续执行代码?