A Java Developers Guide - Dive into the .NET World by Leveraging Your Java Knowledge
Slutsåld
Mok Heng Ngee is an experienced software developer and architect who has been involved in numerous large-scale software enterprise projects based on the Java 2 Platform, Enterprise Edition (J2EE). Mok has writes for "Computer Times "and has been invited to speak at the official launch of Visual Studio .NET in Singapore. He has been accorded MVP (Most Valuable Professional) status by Microsoft Asia.
About the author xiii
Preface xv
Introduction xvii
Acknowledgments xxi
Part 1 Introducing .NET and C# 1
1 Introducing .NET 3
1.1 Evolution: from COM to .NET 3
1.2 What exactly is .NET? 5
1.3 Multiple .NET programming languages and VS .NET 6
1.4 Intermediate language 8
1.5 The .NET common language runtime 9
1.6 Competing in parallel with Java technologies 12
1.7 Common language infrastructure 14
1.8 Other .NET-related technologies 19
1.9 Unsafe codes and real time programs 22
1.10 Porting .NET to other operating systems 23
2 Introducing C# 25
2.1 Potent combo of Java and C!! 26
3 JUMP to .NET and J# 30
3.1 Java Language Conversion Assistant 30
3.2 The J# language 30
4 Hello C#! 34
4.1 How to compile and run the code examples in this book 34
4.2 Some .NET specifics 36
4.3 Disassembling an assembly file 36
Part 2 Classes, methods, and other OO stuff 39
5 Getting started 41
5.1 Basic class structure 41
5.2 Basic console I_O 45
5.3 C# namespaces (Java packages) 50
Contents
6 Class issues 56
6.1 Class modifiers 56
6.2 Class members 56
6.3 Creating an object with the new operator 60
6.4 Looking at System.Object 61
6.5 Class inheritance 63
6.6 Implementing interfaces 65
6.7 Sealed classes (Java final classes) 73
6.8 Abstract classes 73
6.9 Nested classes (Java inner classes) 74
7 Method issues 78
7.1 Method modifiers 78
7.2 Method basics 79
7.3 Instance constructors 84
7.4 Static constructors (Java static initializers) 85
7.5 Destructors 87
7.6 Constructor initializers and constructor chaining 88
7.7 Method overloading 91
7.8 Passing variable numbers of parameters into C# methods 91
7.9 Abstract methods 94
7.10 Method overriding using the virtual and override modifiers 96
7.11 Method hiding with the new keyword 101
7.12 Static methods 105
7.13 Sealed methods (Java final methods) 107
8 Miscellaneous issues 109
8.1 Access modifiers 109
8.2 Static members 114
8.3 C# constants and read-only fields (Java final variables) 116
8.4 Volatile fields 119
Part 3 Types, operators, and flow control 123
9 C# types 125
9.1 Pointer types 126
9.2 Reference types 126
9.3 Value types 129
9.4 Unsigned types in C# 132
9.5 The decimal type 133
9.6 The char type 133
9.7 The string type and string literals 134
9.8 All types are objects 136
9.9 Casting for reference types 139
9.10 Casting for value types 140
9.11 Common typing with other .NET languages 142
10 C# operators 144
10.1 Operators and their precedence in C# 144
10.2 Operator overloading 149
10.3 typeof operator 150
10.4 checked and unchecked operators and statements 153
10.5 The # # operator 159
10.6 The is operator (Javas instanceof operator) 162
10.7 The as operator 164
11 Iteration and flow control 167
11.1 Looping with the while, do, for, continue and break keywords 167<...