Domnic Domnic - 1 year ago 130
C# Question

How to get distinct characters in c#

I have a code like

String code="AABBDDCCRRFF";

In this code I want to retrive only distinct characters

The Output should be like:


Answer Source
        string code = "AABBDDCCRRFF";
        string answer = new String(code.Distinct().ToArray());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download