问一个效率高的数组处理有关问题
问一个效率高的数组处理问题。
String[] tt ={"tt1", "xx2", null, "ww3", null, "uu"};
一个函数,使其变成String[] tt ={"tt1", "xx2", "ww3", "uu"};
------解决方案--------------------
------解决方案--------------------
String[] tt ={"tt1", "xx2", null, "ww3", null, "uu"};
一个函数,使其变成String[] tt ={"tt1", "xx2", "ww3", "uu"};
------解决方案--------------------
String[] tt = { "tt1", "xx2", null, "ww3", null, "uu" };
tt= tt.Except(new string[] { null }).ToArray();
foreach (var item in tt)
{
Console.WriteLine(item);
}
------解决方案--------------------
String[] tt = { "tt1", "xx2", null, "ww3", null, "uu" };
tt = tt.Where(x=>x!=null).ToArray();
foreach (string array in tt)
{
Response.Write(array);
}