Last active
December 15, 2015 05:09
-
-
Save brilligence/5207217 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class Program | |
{ | |
// Sample unordered list of strings | |
private const string OriginalString = "[V],[E],[B],[B],[O],[E],[P],[B]"; | |
private static void Main(string[] args) | |
{ | |
var lst = new List<string>(); | |
lst.AddRange(OriginalString.Split(',')); | |
// Getting duplicate entries from the unordered list | |
var duplicates = lst.GetDuplicates(); | |
// Check if the List<string> extension method works | |
if (duplicates.Count > 0) | |
{ | |
Assert.AreEqual(2, duplicates.Count); | |
Assert.IsTrue(duplicates.Contains("[E]")); | |
Assert.IsTrue(duplicates.Contains("[B]")); | |
} | |
else | |
{ | |
Assert.AreEqual(0, duplicates.Count); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment