In C# "Windows Form Application", How do you remove the duplicate number in an array?
It has to be in Windows Form Application, not in Console Application. Please Reply. Thanks.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Manikavelu VelayuthamRank #413 · 6K reputationPosted Sep 20, 2010, 10:36 PM EDT
1. LINQ
int[] Input = { 11, 12, 13, 13,14};
int[] Output = Input.Distinct().ToArray();
2. Looping
public string[] DeleteDuplicates(string[] InputList) {
System.Collections.ArrayList OutputList = new System.Collections.ArrayList();
foreach (string str in InputList)
if (!OutputList.Contains(str))
OutputList.Add(str);
return (string[])OutputList.ToArray(typeof(string));
}
Eli6 reputationPosted Sep 21, 2010, 2:27 AM EDT
Manikavelu VelayuthamRank #413 · 6K reputationPosted Sep 21, 2010, 3:00 AM EDT