List<string> strs = new List<string>(); foreach (string s in myWords) { if(! string.IsNullOrEmpty(s) ) strs.Add(s); } string[] result = strs.ToArray();
string[] ss = new string[5] { "ss","55",string.Empty,"ee",string.Empty}; foreach(string s in ss) { ArrayList h = new ArrayList(); if (s != string.Empty) { h.Add(s); foreach (string m in h) { MessageBox.Show(m); }
} } 仅供参考!
List<string> strs = new List<string>(); foreach (string s in myWords) { if(! string.IsNullOrEmpty(s) ) strs.Add(s); } string[] result = strs.ToArray();这样就行
List<string> strs = new List<string>();
foreach (string s in myWords)
{
if(! string.IsNullOrEmpty(s) ) strs.Add(s);
}
string[] result = strs.ToArray();
foreach(string s in ss)
{
ArrayList h = new ArrayList();
if (s != string.Empty)
{
h.Add(s);
foreach (string m in h)
{
MessageBox.Show(m);
}
}
}
仅供参考!
foreach (string s in myWords)
{
if(! string.IsNullOrEmpty(s) ) strs.Add(s);
}
string[] result = strs.ToArray();这样就行