ASP. NET program array function call

Source: Internet
Author: User

The array Initialization is very simple. We use the new keyword to create an ArrayList object to assign values to the array item. The ArrayList has the Add method.

We can simply use it to get the size of the array: count

The method is good. Let's take a look at the example below:

<%
Dim arr as new ArrayList
Arr. Add (1)
Arr. Add (3)
Arr. add (2)
Arr. add (445)
Arr. add (223)
Arr. add (112)
Response. write (cStr (arr. count ))
%>

The returned value of this program is 6. If we want to display all the data, we should

<%
For I = 0 to Arr. count-1
Response. write (arr. item (I ))
Next
%>

After executing this program, we will find that the data is not sorted and displayed. We can call the sort method to make this array a sorted array.

<%
Arr. sort ()
For I = 0 to Arr. count-1
Response. write (arr. item (I ))
Next
%>

Through these examples, we have found that in asp.net, we have a powerful array processing object. What I demonstrate here is only the tip of the iceberg about the powerful functions of this object, you can get more surprises by viewing the help of Vs7 beta1.


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.