Asp + syntax (1)

Source: Internet
Author: User

/*
*/ASP + currently supports two languages: C # ("C Sharp" for short), Visual Basic, and JScript.
Based on habits, in the following language introduction, we use VB and C # to develop Web applications for exercises and routines. if you want to obtain information about. for more information about the Net technology, go to the MS site to view the ngws sdk!
In the list below, you can see a brief introduction to the syntax of the two languages
1. Variable name
C # Syntax
Int x;
String s;
String s1, s2;
Object o;
Object obj = new Object ();
Public String name;
VB syntax
Dim x As Integer
Dim s As String
Dim s1, s2 As String
Dim o 'implicitly Object
Dim obj As New Object ()
Public name As String
2 statement
C #:
Response. Write ("tofu ");
VB:
Response. Write ("tofu ")
3. Comment statement
// Bean curd is made of excellent products
/*
Tofu production
,
All are excellent products
*/
VB:
'Tofu is made of excellent products.
'Tofu making
',
'All are excellent products
4. Get the variable passed by the URL
C #:
String s = Request. QueryString ["Name"];
String value = Request. Cookies ["key"];
VB:
Dim s, value As String
S = Request. QueryString ("Name ")
Value = Request. Cookies ("Key"). Value
5. Declare attributes
C #:
Public String name {
Get {
...
Return ...;
}
Set {
... = Value;
}
}
VB:
Public Property Name As String
Get
...
Return ...;
End Get
Set
... = Value;
End Set
End Property
6. Array
C #
String [] a = new String [3];
A [0] = "1 ";
A [1] = "2 ";
A [2] = "3 ";
// Two-dimensional array
String [] [] a = new String [3] [3];
A [0] [0] = "1 ";
A [1] [0] = "2 ";
A [2] [0] = "3 ";
VB:
Dim a (3) As String
A (0) = "1"
A (1) = "2"
A (2) = "3"
Dim a (3, 3) As String
A (0, 0) = "1"
A (1, 0) = "2"

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.