1. <% response. write ("AAA"); %>
2.int A = 100, B = 5;
convert. tostring (a + = B);
3.int c = 888;
Int? Cc = NULL;
label1.text = convert. tostring (CC ?? C);
4. double R = 231.725;
int u = convert. toint32 (r); // 232
decimal q = 151515.1156553311 m;
double X = convert. todouble (Q); // 151515.116
5. string [] arr;
arr = new string [5];
string [] abc = new string [3];
string [] aidd = {"AA", "BB", "cc" };< br> string [,] A = new string [2, 4];
A [0, 0] = "00";
//...
//. dimension of rank A
//. getupperbound (. rank-1) Maximum array dimension index upper limit
// getupperbound (0) Minimum dimension index upper limit
For (INT I = 0; I <A. rank; I ++)
For (Int J = 0; j <= A. getupperbound (A. Rank-1 ))
Response. Write (A [I, j]. tostring ())
6. public struct book // structure you want the structure to be owned by this pageCodeAccess
Public int price;
Public String title;
Public String author;
Public int OK;
Enum em
ABC = 0,
BCD = 1,
CDE = 2
Eunm EE {TTT, CCC, AAA} // One-Way increments starting from 0 by default
Enum EE {TTT = 1, CCC = 5, AAA = 9}
book BK;
book Bok = New Book ();
Bok. title = "title";
bok.0k = convert. toint32 (EE. TTT);
7. string A = "12345";
//. length
8. string [] aidd = new string [] {"123", "234", "456" };< br> foreach (string R in aidd)
If (R. contains ("2")
r. tostring ()
9. like java, C # does not allow global functions. All functions must be implemented in a class or structure. A function is a member of a class or structure. A function is also called a method.
10. Switch (c)
case C <23: // error. It can only be judged by simple values or strings, and cannot be computed
//...;
break;
case
11. function ref
12. object-Oriented Programming (OOP)
it is easier to write code more effectively and easier to maintain and understand
write more practical and beautiful Code
13. public class Cal
private string color; // The lower-case start of the member variable
Public String color // The upper-case start of the attribute
Get
return color;
set
color = value;
// get and set accessors
Cal mycal = new Cal ();
Mycal. Color = dropdownlist1.selectedvalue. tostring ();
14. constructor Operator Overloading
Msdn
Avoid defining Operator overloading, except when its usage is similar to primitive (built-in) Type
Consider defining Operator Overloading in a usage similar to a primitive type.
Public class fuhao
{
Private string aidd;
Private int age;
Public fuhao
{}
...
Public static string operator + (fuhao A, fuhao B)
{Return ...;}
}
Fuhao FH = new ...;
Fuhao fh2 = new ...;
// FH + fh2; // the overload of class addition is used.
Is the operator retainable?
18. Ele. Me is the programming mode driven by your death.
Asp html does not return PostBack
Event-driven programming is executed according to the user's meaning, and each event processing process is completed on the server.
Events in. net
Object-Oriented Programming, object, page object, and HTML executable outputProgram. Each call, initialization, processing, display, and release are closed. Events are triggered in each step.
If an event is not triggered by yourself, it will be executed after the event is processed.
Page_init
Work only once, reload does not work. Check client environment variables
19. button#click (Object sender, eventargs E)
Buttonstmcommand (Object sender, commandeventargs e) // This is also used by the link button.
Dropdownlist1_selectedindexchanged (Object sender, eventargs E)
Switch (dropdownlist1.selectvalue)
Case "":
//
Break;
Check whether autopostback is returned when you click the button.
Checkbox1
If it is sent back, click the button, except for the new page with Ajax and other technologies.
20. The object belongs to the class.
A single class inherits system. Object/Object
Class:
Attribute memory read-only
Method
Event
Function
Member variables and member functions are all class members/divided into static and entity members
Public static string AAA;
Public static void AAA ()
{}
Public String AAA;
Public void AAA ()
{}
C # all objects will be created on the managed stack.
The instantiated type is called an object. Its core feature is that it has a copy of its own unique data member.
The data members held by these special objects are called instance members.
On the contrary, data members that are not held by special objects are called static members, and are declared using static modifiers in the class.
Static function members that only perform operations on static data members
Access Modifier
Public
Private class
The protected class inherits this class internally.
Internal the same application or library | not required