From Java to C#: A Developer's Guide

Heng Ngee Mok

  • 出版商: Addison Wesley
  • 出版日期: 2003-01-17
  • 售價: $1,580
  • 貴賓價: 9.8$1,548
  • 語言: 英文
  • 頁數: 464
  • 裝訂: Paperback
  • ISBN: 0321136225
  • ISBN-13: 9780321136220
  • 相關分類: C#Java 程式語言
  • 下單後立即進貨 (約5~7天)



Table of Contents:

About the Author.



1. Introducing .NET.

Evolution: from COM to .NET.

What exactly is .NET?

Multiple .NET programming languages and VS .NET.

Intermediate language.

The .NET common language runtime.

Competing in parallel with Java technologies.

Common language infrastructure.

Other .NET-related technologies.

Unsafe codes and real time programs.

Porting .NET to other operating systems.

2. Introducing C#.

Potent combo of Java and C!!

3. JUMP to .NET and J#.

Java Language Conversion Assistant.

The J# language.

4. Hello C#!

How to compile and run the code examples in this book.

Some .NET specifics.

Disassembling an assembly file.


5. Getting started.

Basic class structure.

Basic console I/O.

C# namespaces (Java packages).

6. Class issues.

Class modifiers.

Class members.

Creating an object with the new operator.

Looking at System.Object.

Class inheritance.

Implementing interfaces.

Sealed classes (Java final classes).

Abstract classes.

Nested classes (Java inner classes).

7. Method issues.

Method modifiers.

Method basics.

Instance constructors.

Static constructors (Java static initializers).


Constructor initializers and constructor chaining.

Method overloading.

Passing variable numbers of parameters into C# methods.

Abstract methods.

Method overriding using the virtual and override modifiers.

Method hiding with the new keyword.

Static methods.

Sealed methods (Java final methods).

8. Miscellaneous issues.

Access modifiers.

Static members.

C# constants and read-only fields (Java final variables).

Volatile fields.


9. C# types.

Pointer types.

Reference types.

Value types.

Unsigned types in C#.

The decimal type.

The char type.

The string type and string literals.

All types are objects.

Casting for reference types.

Casting for value types.

Common typing with other .NET languages.

10. C# operators.

Operators and their precedence in C#.

Operator overloading.

typeof operator.

checked and unchecked operators and statements.

The # # operator.

The is operator (JavaÎs instanceof operator).

The as operator.

11. Iteration and flow control.

Looping with the while, do, for, continue and break keywords.

Conditional statements using the if and else keywords.

Looping with the foreach keyword.

Conditional statements with the switch and case keywords.

Flow control with the break and continue keywords.

Flow control with the goto keyword.


12. Arrays.

One-dimensional arrays.

Multi-dimensional arrays: rectangular arrays.

Multi-dimensional arrays: jagged arrays.

Mixing jagged and rectangular arrays.

Using the System.Array class.

13. Exception handling.

Exception examples.

C# exception hierarchy.

Examining System.Exception.

Inner exceptions.

Catching generic exceptions.

14. C# delegates.

What are delegates?

A first delegate example.

Combining delegates.

Removing delegates.

Exception throwing in delegates.

Passing method parameters by reference in delegates.

15. C# events.

Generic event model.

What are C# events?

A full example.

Another full example.

16. Reflection and dynamic method invocation.

Retrieving the type of an instance.

Retrieving the type from a name of a class.

Retrieving methods from a type.

Retrieving modules from an assembly.

Dynamically invoking methods in late bound objects.

Creating new types during runtime.

17. Multi-threaded programming.


Thread states and multi-threading in C#.

Thread synchronization.

Threading guidelines.

18. File I/O.

Copying, moving, and deleting files.

Copying, moving, and deleting directories.

Reading from or writing to binary files.

Reading from and writing to text files.

19. C# collection classes.







V. Convenience features.

20. C# properties.

Properties as a replacement for accessor and mutator methods.

Having only either the get or set section.

Inheritance of properties.

21. C# indexes.

Overloading indexers.

Wrong use of indexers.

22. Operator overloading.

Explaining operator overloading.

Operator overloading proper.

Another example of operator overloading.

23. User-defined conversions/casts.

The implicit and explicit keywords.

Syntax of user-defined conversion method declarations.

VI. C#-specific features.

24. C# preprocessor directives.

Conditional compilation with #define, #undef, #if and #endif.

#else and #elif.

The /define compiler option and #undef.

#warning and #error.

#region and #endregion.

25. Using enums.

Specifying different int values for enum elements.

26. C# structures.

First look at structs.

Differences between a struct and a class.

Why use a struct?

27. C# attributes.

First look at attributes.

Standard attributes.

28. Writing custom attributes.

An attribute class.

Another custom attribute example.

Naming attribute classes and attribute specifications.

Custom attributes in depth.

The AttributeUsage attribute.

29. Writing unsafe codes.


Comparing Java and C#/.NET.

Introducing pointers.

Using the unsafe keyword.

Declaring pointers.

Using the & address-of operator.

Using the * indirection operator.

Passing pointers to methods.

Using the -> member access operator.

Using the sizeof operator.

Pointer casting.

Pointer arithmetic.

Using the fixed keyword.

A further example.


Appendix A: Keywords in C#.
Appendix B: Comparing Java and C# keywords.
Appendix C: C# coding conventions.
Appendix D: XML documentation.
Appendix E: C# command line tools.
Appendix F: About .NET assemblies.

What is an assembly?

Shared assemblies and the GAC.

What is DLL hell?

Creating DLL assemblies using csc.exe.

Compiling to modules.

Referencing an external module during compilation of an assembly.

Appendix G: Abbreviations used in this book.