. NET C # ASP. NET relationship:. NET is a platform that provides programs for running virtual machine environments and class libraries.
C # is a language on the. NET platform, and other languages include vb.net PowerShell, and so on.
Asp. NET is the Web development technology under. NET.
The. NET framework is installed to run. VS integration Installs the. NET FrameWork.
Console program windows Windows Program (WPF/WINFORMS) website program ASP. NET Phone program (xarmarin windows Phone)
Shortcut keys:
Format document (Edit-Advanced-"format document")
Start Debugging F5
Solutions and Projects SLn csproj
Debug Release (Debug run inefficient, contains debug information Release generated program small, debugging Trouble)
Console.beep (Int,int) lets the computer beep. The first parameter is the frequency, and the second parameter is the time.
consol.setcursorposition (int x,int y) sets the cursor position, and the horizontal x does not exceed 79.
console.backgroundcolor=consolecolor.red;
Console.foregroundcolor=consolecolor.blue;
Console.resetcolor (); Restore default settings
The Anti-compilation tool Ilspy comment does not, because the comment information is not in the EXE file. cannot be completely restored. can only be deserialized. NET program.
How to avoid anti-compilation: obfuscation, not much research value. Because the main web application, is placed on the server, ordinary users are not get the program.
String is the keyword, but string is not a keyword. Main is not a keyword either.
Identifiers are used for classes, methods, and variables. Class, method first letter uppercase. Variable first letter lowercase, hump naming method. Createmenuitem
You must assign a value before the local variable is used.
When you select a data type, you can save resources by selecting the minimum range type after considering the range of data.
Implicit type conversions and forced type conversions
Float f=3.14//error, 3.14 is a double type and needs to be specified as float f=3.14f
Doublue D=3.14/3.14D/5 is all you can.
\ n is also a character.
Console.WriteLine (@ "C:\test.txt");
i.ToString ();
Convert.ToString (i); recommended, NULL does not throw an exception.
C # is not allowed to create a string object with the new operator, and the compiler will give an error.
There are three versions of equals:
PublicOverrideBOOLEquals (Object);
PublicBOOLEquals (string);
PublicStaticBOOLEquals (string,string);
The first two instance methods call the CompareOrdinal static method, which will each character in the string, Returns true if they are equal. The third one checks whether the two references point to the same object, and if so, returns true and no longer compares the individual characters.
The CLR actually uses a technique called string residency, for
string str1= "abc";
string str2= "ABC";
When the CLR initializes, an internal hash table is created, where the key is a string and the value is a reference to a string in the managed heap. At first, the hash table is empty, and when the JIT compiler compiles the method, it looks for each literal constant string in the hash table, first looks for the "ABC" string, and because it is not found, the compiler constructs a new string object reference to "ABC" in the managed heap and then "ABC" A string and a reference to the object are added to the hash table.
Next, find the second "ABC" in the hash table, this time because the string is found, so the compiler will not take any action, there is no other text constant string in the code, the compiler's task is complete, the code begins to execute. When executed, the CLR discovers that the first statement requires an "ABC" string reference, so the CLR looks for "ABC" in the internal hash table and finds it, so that a reference to the previously created string object is saved in the variable S1, and when the second statement is executed, The CLR will again look for "abc" in the hash table, and will still find a reference to the same string object being saved in the variable s2, where S1 and S2 point to the same reference, so System.Object.Equals (S1,S2) returns True.
Console.Write (5 + 5 + "Hello" + (4+4));
Arithmetic > Relationships > Logic > Assignment
. NET Foundation