Home  >  Article  >  Backend Development  >  C# remove duplicate data from array

C# remove duplicate data from array

黄舟
黄舟Original
2017-02-16 11:05:542004browse

   #region 移除数组中重复数据
        /// <summary>
        /// 移除数组中重复数据
        /// </summary>
        /// <param name="array">需要除重的数组</param>
        /// <returns>不重复数组</returns>
        public static string[] DelRepeatData(string[] array)
        {
            return array.GroupBy(p => p).Select(p => p.Key).ToArray();
        }

        #endregion

The above is the content of C# to remove duplicate data in the array. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn