diff --git a/Apewer/CollectionUtility.cs b/Apewer/CollectionUtility.cs index 2d6c59d..7ad3b93 100644 --- a/Apewer/CollectionUtility.cs +++ b/Apewer/CollectionUtility.cs @@ -952,6 +952,30 @@ namespace Apewer #endregion + #region Join + + /// 连接多个集合的元素为单个集合。 + public static T[] Join(params IEnumerable[] collections) + { + if (collections == null) return new T[0]; + + var count = collections.Length; + if (count < 1) return new T[0]; + + var result = new List(); + foreach (var collection in collections) + { + if (collection == null) continue; + foreach (var item in collection) + { + result.Add(item); + } + } + return result.ToArray(); + } + + #endregion + } }