Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个代码,可以一次将 30 个字符串从随机更新的数据源复制到剪贴板;有时在一秒钟内超过一百个新字符串,有时几分钟内没有更新。我想通过套接字将所有字符串发送到数据库。在不发送重复项的情况下通过套接字发送字符串的最有效方法是什么?
一种简单但有效的方法是在将字符串发送到数据库之前使用 LINQ 检查并删除重复项:
string[] original; //the array where all the string from your clipboard are in string[] newStrings = original.Distinct().ToArray();
这样您就可以从original.
original