Please help me to fix this issue. My dropdown list looks something like this mentioned below.
- Client
- Contractor,Contractor,Contractor,Manager
- Contractor,Manager
- Manager
- Operator
- Viewer
I want to remove the duplicates and my output should be like :
- Client
- Contractor
- Manager
- Operator
- Viewer
This is my code mentioned below:
Property:
public List<string> TeamRoleNames => TeamRoleUids.Select(MainRoles.GetRoleName).ToList();
Display Method:
{
result += " ; TeamRoleNames=" + this.TeamRoleNames;
}
GetRole Method:
{
string roleName;
if (RoleNameByUid.TryGetValue(roleUid, out roleName))
{
return roleName;
}
return null;
}
I have tried with Distinct Method mentioned below, But did not work like the output what I wanted!
public List<string> TeamRoleNames => TeamRoleUids.Select(MainRoles.GetRoleName).Distinct().ToList();
How can I fix this? Can anyone help?