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.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manikavelu VelayuthamPosted Sep 21, 2010, 2:36 AM
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));
}
Manikavelu VelayuthamPosted Sep 21, 2010, 7:00 AM
EliPosted Sep 21, 2010, 6:27 AM