c# - c#删除自定义列表的重复项
问题描述
你好,我有一串像
BRC CORP---BRC SME,BRC SME---BRC CORP,Confirmation of Customer Contact,Confirmation of Suitability Check,Consent,Driver's License---National Id Card,National Id Card---Driver's License,Residence certificate
现在我需要将其转换为下面的列表。
using System.Collections.Generic;
using System.Linq;
try
{
string mondantory_docs=Batch.Properties.Get("MissingDocCheck");
List<string> result = mondantory_docs.Split(',').ToList();
}
catch
{
}
但是我有一个问题,我找不到方法。BRC CORP---BRC SME
并且BRC SME---BRC CORP
通常是相同的。所以我需要从列表中删除其中一个。结果我想在下面。
BRC CORP---BRC SME,Confirmation of Customer Contact,Confirmation of Suitability Check,Consent,Driver's License---National Id Card,Residence certificate
如何从列表中删除这种重复项
谢谢
亲切的问候
解决方案
拆分字符串后,将其添加到列表中,将其添加到 HashSet。然后将其转换为列表。这应该删除重复项。
推荐阅读
- xml - XSL value-of 返回没有值
- sql-server - 根据另一个表中的数据将行旋转到列
- ocr - tesseract 4.0.0-beta.1 字符周围的边界框
- python-3.x - 如何进行对称加密?我有问题
- docker - tomcat docker挂载卷变空
- java - 片段 - 标记、条件和显示
- react-native - React Native 中如何实现滑动访问不同的导航界面?
- express - 如何从 NestJS 中的 GraphQL 解析器设置会话?
- azure - Azure Databricks 的 Azure DevOps 管道
- opencv - 无法在 Renesas R-Car H3 (H3ULCB) 上安装 libgtk2.0-dev_2.24.31-2_arm64.deb