日期:2014-05-20  浏览次数:20746 次

LINQ的问题,在线等待.
List<string[]> p = new List<string[]>()
  {
  new string[]{"a","b","c"},
  new string[]{"1","2","3"}
  };

现在想把p转成下面的s,请问如何做呢?谢谢!

string[] s = new string[] { "a", "b", "c", "1", "2", "3" };

------解决方案--------------------
C# code

    public static class MyExtension
    {
        public static T[] GetList<T>(IEnumerable<T[]> t)
        {
            List<T> list = new List<T>();
            foreach(T[] arr in t)
            {
                foreach(T item in arr)
                {
                    list.Add(item);
                }
            }
            return list.ToArray();
        }
    }