Asp. NET array Delete duplicate Value implementation Code _ Practical skills

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.