判断数组值是否有重复

 for (int t = 0; t < serviceTag.Length; t++)//2  12 12
            {
                for (int j = t+1; j < serviceTag.Length; j++)//2 12 12
                {
                    if (serviceTag[t] == serviceTag[j])
                    {
                        for (int i = 1; i <= Quantity; i++)
                        {
                            TempData[i.ToString()] = Request[i.ToString()];
                        }
                        ViewBag.Quantity = Quantity;
                        ModelState.AddModelError(string.Empty, "错误内容:" + serviceTag[t] + "---" + "Service Tag页面填写重复!");
                        return PartialView(modelReport);
                    }
                }
            }

  

猜你喜欢

转载自www.cnblogs.com/Neil-Peng/p/9038286.html