. Net 4.0 object-oriented programming Talk (fundamental) study notes a
|
|
Chapter based object-oriented programming (nothing useful things)
vs2002 7.0
vs2003 7.1
vs2005 8.0
vs2008 9.0
vs2010 10.0
Any CPU x86 x64 Itanium
In-Process Side-by-Side Execution in the host within the same process a number of different versions of the CLR,. Net 4.0 introduced
. Net framework SDK: C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ bin
ildasm and many other tools in this directory
v6.0A framework 2.0 seems to be for the
REPL Read-Evaluate-Pring Loop
Something about the data types chapter
. Net 4.0 introduces a BigInteger type, can represent arbitrarily large integer; and before the maximum is long (Int64)
Managed thread stack and heap
private void DoSth ()
{
Object obj; / / compiler will automatically delete these lines of code. (Optical declared but not initialized and not being used will be removed by the compiler, if you try to use an uninitialized field, will not in the past are they compile)
Console.WriteLine (“done!”);
}
== Used to compare the internal value type is a more realistic value, compared to a reference type, the comparison is the reference address. The string type overrides == operator, it looks like a value type.
But I think the comparison is == the internal real value, value for value types in that, while the value of reference type is actually a managed heap address, string type is unique (the same two strings managed heap is an address)
Operator overloading: public static bool operator == (string a, string b);
Struct types of the special features:
1. Inherited from ValueType
2. Can not be inherited
3. Can not be defined without reference constructor
4. Can not have initializer
5. In the constructor must be assigned to all fields
6. Must be assigned before use, for example, Point p; Console.WriteLine (pX); / * can not compile * / pX = 3; Console.WriteLine (pX); / * ok, pass but now can not access the Y, because Y has not been assigned * /
String’s special about
CLR has a table called the resident pool (temporary pools) Intern Pool
string s1 = “aaaa”;
string s2 = “aaaa”;
string s3 = new String (‘a’, 4);
string s4 = string.Intern (s3); / / string of static methods that reside in the pool if there is a direct reference to return address
(Object) s1 == (object) s2 / / true
(Object) s1 == (object) s3 / / false
(Object) s1 == (object) s4 / / true
String type can be added to any object, which is equivalent string.Concat
Nullable
int i = ni?? 0;
There may be empty types in operation, the results for the nullable type, bool? Except for some special rules (& |), such as false & null as false …….
dataObject.AnNullableInt = dr ["IntColumn"] as int?; / / dr as DataRow, value types can use one of the empty
Chapter fields, methods and properties Talk
Tuple tuple pronounced ah
Static methods can be used Tuple.Create and to create a new Tuple
. Net is defined in the definition of 1 to 7 Tuple
Tuple
This last TRest is another Tuple, you can sign sets.
Tuple
Console. WriteLine (t. Item1);
Console. WriteLine (t. Item2);
Tuple role is as a method return value, a one-time return multiple results.
partial method (division method)
0. Partial method can not have a return value
1. Partial method can not be added before any access modifiers (ie private), a partial is defined, and the other is to achieve
2. Partial method can only be defined in the partial class
3. If only the definition part, does not implement parts of the code that the compiler will call the delete
4. Its role is to provide a method of “functional extension points”, for example, Linq2Sql automatically generated entity classes have a wide range of applications (such as OnXxxChanging, OnXxxChanged)
Generic extension methods
static class MyExts
{
public static void Test
{
//……….
}
}
Sorry, the comment form is closed at this time.


Comments
No comments yet.