According to this code, I wrote a small program as a reference to code information, convenient to use directly after, do not need to find online. If you think it's good, put it on the collection!
1. Front Code:
2. Background code:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls; Using System.Collections; Reference public partial class Netobjects_ Array _ Delete duplicate value: System.Web.UI.Page {protected void Page_Load (object sender, even
Targs e) {string strnum = "168,145,150,148,333,888,666,168,144";
Output original Array lblresult1.text = Strnum;
string[] Arrnum = Strnum.split (', ');
ArrayList al = new ArrayList (); for (int i = 0; i < arrnum.length i++) {//To determine if an array value already exists if (al. Contains (arrnum[i]) = = False) {al.
ADD (Arrnum[i]); }///convert ArrayList to array arrnum = new String[al.
Count]; Arrnum = (string[]) al.
ToArray (typeof (String));
The output is deleted after the array string result = "";
for (int j = 0; J < Arrnum.length J + +) {if (J!= 0) {result = ",";
result = = Arrnum[j];
} Lblresult2.text = result; }
}
3. Final output effect:
The above is about the asp.net array delete duplicate values of the implementation method, I hope to help you learn.