Chapter 1 Object-Oriented Programming Basics (Nothing useful) vs2002 7.0vs2003 7.1vs2005 8.0vs2008 9.0vs2010 10.0 any CPU x86 x64 itanium in-process side-by-side execution in the same process host multiple different versions of CLR ,. net 4.0 introduced. net Framework SDK: C: \ Program Files \ microsoft sdks \ windows \ v7.0a \ bin ildasm and many other tools are in this directory. v6.0a seems to be a repl read-evaluate-Pring loop for Framework 2.0.
Chapter 2 Data Types . Net 4.0 introduces a biginteger type, which can represent any large integer. The previous maximum is long (int64) thread stack and managed heap private void dosomething () {object OBJ; // The compiler will automatically set this line Code Delete. (It is declared but not initialized and not used by the compiler. If you try to use an uninitialized field, it cannot be compiled.) console. writeline ("done! ") ;}== Used to compare the actual value of the value type. used to compare the reference type, the reference address is compared. The string type overwrites the = Operator, so it looks like a value type. However, I think = is the actual internal value. For the value type, the value is there, and the value of the reference type is actually a managed heap address, the string type is unique (two identical strings are an address on the hosting stack) operator overload: public static bool operator = (string a, string B); special features of the struct type: 1. inherited from valuetype2. cannot be inherited 3. the parameter-free constructor cannot be defined. 4. initializer5. all fields must be assigned a value in the constructor. 6. you must assign values before use, for example, point P; console. writeline (P. x);/* cannot compile */P. X = 3; console. writeline (P. x);/* OK, pass, but cannot access y at this time, because y has not been assigned a value */string. A table in CLR is called a resident pool (temporary storage pool) intern poolstring S1 = "AA AA "; string S2 =" aaaa "; string S3 = new string ('A', 4); string S4 = string. intern (S3); // string static method. If a static method exists in the resident pool, the reference address (object) S1 == (object) S2 // true (object) is returned) s1 = (object) S3 // false (object) S1 = (object) S4 // true string type can be added to any object, equivalent to string. concat nullable <t> int I = ni ?? 0; can there be null types involved in the operation, the result can also be empty type, bool? Except for some special rules (& |), for example, false & null is false ...... dataobject. annullableint = Dr ["intcolumn"] As Int ?; // Dr is a datarow, which can be one of the functions of the null type
Chapter 3 field, method, and attribute You can use tuple. create static method and new tuple <t1, T2> to create a tuple object. net ~ Seven tuple definitions tuple <t1> tuple <t1, T2> .... tuple <t1, t2 .. t7>, tuple <t1 ,... t7, trest> the last trest is another tuple, which can be set. Tuple < Int , Int > T = New Tuple < Int , Int > ( 8 , 5 );
Console . Writeline ( T . Item1 );
Console . Writeline ( T . Item2 ); One function of tuple is to return multiple results at a time as the return value of the method. Partial method (partial method) 0. the partial method cannot return value 1. you cannot add any access modifier (private) before the partial method. One partial is defined, and the other is implementation 2. the partial method can only be defined in the partial class. if there is only a definition part and no implementation part, the compiler will delete the called code 4. it provides a Function Extension point for the method. For example, it is widely used in the Entity classes automatically generated by linq2sql (such as onxxxchanging and onxxxchanged) generic Extension Method static class myexts {public static void test <t> (this t OBJ) // The generic extension method can provide extensions for any type {//..........}}
Published by wiz