首页 > 开发 > 综合 > 正文

C# Source 与VB Source 的不同

2024-07-21 02:29:16
字体:
来源:转载
供稿:网友


c# source


   intro2_cs.aspx

 

 1 <%@ page language="c#"%>
 2
 3<html>
 4   <head>
 5      <link rel="stylesheet"href="intro.css">
 6   </head>
 7
 8   <body>
 9
10       <center>
11
12       <form action="intro2_cs.aspx" method="post">
13
14           <h3> name: <input id="name" type=text>
15
16           category:  <select id="category" size=1>
17                          <option>psychology</option>
18                          <option>business</option>
19                          <option>popular_comp</option>
20                      </select>
21
22           </h3>
23
24           <input type=submit value="lookup">
25
26           <p>
27
28           <% for (int i=0; i <8; i++) { %>
29              <font size="<%=i%>"> welcome to asp.net </font> <br>
30           <% }%>
31
32       </form>
33
34       </center>
35
36   </body>
37</html>
38
 

  vb source


   intro2_vb.aspx


 1 <%@ page language="vb" %>
 2<html>
 3   <head>
 4      <link rel="stylesheet"href="intro.css">
 5   </head>
 6
 7   <body>
 8
 9       <center>
10
11       <form action="intro2_vb.aspx" method="post">
12
13           <h3> name: <input id="name" type=text>
14
15           category:  <select id="category" size=1>
16                          <option>psychology</option>
17                          <option>business</option>
18                          <option>popular_comp</option>
19                      </select>
20
21           </h3>
22
23           <input type=submit value="lookup">
24
25           <p>
26
27           <% dim i as integer
28              for i = 0 to 7 %>
29              <font size="<%=i%>"> welcome to asp.net </font> <br>
30           <% next %>
31
32       </form>
33
34       </center>
35
36   </body>
37</html>
38
39 
 

  学习c# source intro2_cs.aspx 与vb source  intro2_vb.aspx 的不同后,发现c#的代码有些难度.特别是两个循环上有很大区别,
c#


1<% for (int i=0; i <8; i++) { %>
2              <font size="<%=i%>"> welcome to asp.net </font> <br>
3           <% }%>
4
vb


1 <% dim i as integer
2              for i = 0 to 7 %>
3              <font size="<%=i%>"> welcome to asp.net </font> <br>
4           <% next %>
5
vb还是很直观,一直在学vb所以感觉很好理解.c#反而像是c语言.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表