Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does the array look like in the basic ASP.NET tutorial

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

ASP.NET basic tutorials what the array is, for this problem, this article describes in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and easy way.

ASP.NET basic tutorials array instance learning, first let's look at the characteristics of the array, ASP.NET array (Array) can be regarded as storing multiple values of the same data type of variables, with the same variable name, different index values to distinguish the representation of multiple values. It is often used to store data of the same nature or type.

ASP.NET basic tutorials array example 1. Declaration of the array

The declaration of an array has the following two formats:

The following is a reference clip:

◆ Dim array name (number of elements) [As data type]

◆ Dim array name () [As data type] = {element value l, element value 2... }

ASP.NET basic tutorials array example 2. Representation of array elements

When an array is declared and assigned its elements, the array can be executed, where the elements of the array are represented as follows:

Array name (index value) = element value

Tip: the index value is calculated from 0. The number of array elements can be declared up to 264-1 (that is, the Long type).

ASP.NET basic tutorials array example 3. Example

Write an ASP program, use the array to make it into the web page

The ability to display the date of the day.

Program code:

The following is a reference clip:

01 < html >

02 < hr >

03 <%

04 Dim cw (7)

05 cw (0) = Sunday ".

06 cw (1) =-Monday "

07 cw (2) = "Tuesday"

08 cw (3) =-Wednesday "

09 cw (4) =-Thursday.

10 cw (5) =-Friday "

11 cw (6) =-Saturday.

12 response.write (- Today is & yea r (now ()) & "year")

13 response.write (month (now)) & "month" & day (now ()) & "Day")

14 response.write (cw (Wee kDay (now ()-1))

15% >

16 < hr >

L7 < / html >

The procedure is described as follows

Lines 3-15 of ◆: the body of the ASP program.

Line 4 of ◆: declare an array of CW with seven elements.

Lines 5-11 of ◆: define each element in the array. The data type is a string.

◆ lines 12-14: use the date-time function and array to output the date using the write method of the response object, in line 14, replace the WeekDay function .A, now () function to find the week value, the value range is 1-7, because the index value in the array is to be substituted, and the index value in the array is calculated from 0, so subtract 1 in this output program and set the range of the week value at 0,6. To match the index values of the array to bring out the string that each index value represents.

This is the end of the array example analysis and explanation of ASP.NET basic tutorials, so do you know something about arrays through this kind of learning?

This is the answer to the question about how the array is in the ASP.NET basic tutorial. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report