80- XX. , . . , , . , , .
. , , , . : 1. . . , , , . 2. . , . 3. , . , . , , , . , . 2 : 1. - , , . 2.- , , . .
, : 1. ? 2. ? 3. ? . 1. . , . , , . , ( ). . . . . , . , .. , . , , , . 2. . , - . , , -. . , () . , , -. , . . . 3. . , .. , . , , . , , . , . . : , , ; , . get set. , , . . , .
|
|
. , , . C# . , , . , .
12. C#. . : , , .
. , - ( ), (, , , , , ) . . : // public, , // internal - publicclassHelloWorldClass {publicvoidHelloWorld() {Console.WriteLine("Hello, world");}} . () (). (accesscontrollevel). , . : public, protected, internal, protected internal, or private. internal: ; internalprotected ; , . private ( , ) , . ; protected (, , ) , , -; public ( , ) . . . ref , . out .
|
|
. , , virtual. , , override. . , . - public, static, protected, abstract virtual, override, new extern. , .
ReadLine. ReadLine ( ).
Write WriteLine. Write . . ., Write , .
Main - . . . WriteLine System.Console. . . (-, datamember, classfield, instancevariable) - , . . . , .
. , ( (structure) , (record) ..), , . , , . . . (staticdatamembers, staticclassfields, classvariables) , . , , , , . . (, ); , . : , . (readonly Fields). , const .
. C#. (events) windows Button , ( ). .
|
|
: 1) , . 2) . . 3) , , . 4) , . 5) , . 6) . 7) .NET Framework EventHandler EventArgs.
13.. . new.
, . .
: 1) ; 2) ; 3) .
public, .. ( ). , C# , , , - null- . : - , . , , , . . : - . . ().
newCLR . , , , ( void). , , .
new . new. , . .
, , .
14. . : . .
C# : (value- based) (reference- based). (int, float .), . ( ), . . , . LiFO (LastinFirstOut - ). , . . NetRuntime . , , . , CLR , . NextPtr (NextPointer) , . , , . new , CLR . NextPtr . . new . NextPtr . NextPtr ← ; ; . 3 : , . (, , , ) , - . , . , .. . .
|
|
. , . . , . null, . , . . studentstud3= stud1; stud1 stud3 . , stud1, stud3. stud3.Addstip (-10000); stud3. Show_Student (); stud1. Show_Student (); (). : . C# . (boxing). , ( S) shortS=25;
: ( S) objectobjshort=s; ( )
- . : ( -25). (unboxing). . CLR , . ( )
shortanotherShort=(short) objshort; , , InvalidCastException. ( ) StringStr=(string)objshort;
C# . , , , . C# , .
15. . .
, , . . , . : _ () . :1) ; 2) public; 3) , . . . , . . . - . . , , , , , .. , , , , , . . CLR. . , , , . , . .NET CLOSE DISPOSE. , . , . (finalization). , , . . , . CLR . . , (, ). .
|
|