如何从一个TextBox删除重复? [英] How can I remove duplicates from a TextBox?

查看:132
本文介绍了如何从一个TextBox删除重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了一个新的行每个项目的文本框。我试图从本框删除重复。我想不出任何东西。我尝试添加每个项目到一个数组和删除重复项,但它不工作。是否还有其他选择吗?


解决方案

  yourTextBox.Text =的string.join(环境。换行,yourArray.Distinct()); 


I have a text box that has each item on a new line. I am trying to remove duplicates from this textBox. I can't think of anything. I tried adding each item to an array and the removing the duplicates, but it doesn't work. Are there any other options?

解决方案

yourTextBox.Text = string.Join(Environment.NewLine, yourArray.Distinct());

这篇关于如何从一个TextBox删除重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆