You are previewing .NET for Java Developers: Migrating to C#.
O'Reilly logo
.NET for Java Developers: Migrating to C#

Book Description

.NET for Java Developers is the definitive guide to leveraging your Java programming experience in the .NET environment. Understanding the similarities and differences between the C# and Java APIs enables Java programmers to quickly begin rapid application Windows development using C#. The numerous code examples, which have been tested using Visual Studio® .NET 2003 and Java 1.4, show readers how to create feature-rich .NET applications by translating Java coding practices into C#.

The authors begin by detailing the .NET Framework and then immediately introduce readers to coding and the Visual Studio® .NET IDE. They compare the features of C# and Java, and provide a systematic analysis of how the two languages relate to each other. Readers cover the essentials of C# programming, from object creation to event programming, before moving into advanced areas, such as database access, XML processing, GUI programming, and reflection.

Key topics that explain how to do smart C# programming rather than emulating Java code in C#:

  • Database access

  • Inheritance and polymorphism

  • Thread programming

  • Garbage collection and memory management

  • C# application deployment

  • Delegates

  • Processing XML

  • .NET for Java Developers provides Java developers, programmers, and architects with experience-based advice for a successful transition into the .NET environment.



    0672324024B06242003

    Table of Contents

    1. Copyright
    2. Preface
    3. C# Essentials
      1. The .NET Framework
        1. What Is .NET?
        2. .NET Framework Terminology and Core Concepts
        3. CLR and the JVM
        4. Memory Management
        5. Security Management
        6. Exception Management
        7. Overview of the .NET Framework Class Library
        8. Summary
      2. Starting with C#
        1. The .NET SDK
        2. Writing Your First C# Program
        3. C# Performance
        4. C# Tools
        5. Summary
      3. C# and Java: What Is the Difference?
        1. Programming Platforms (.NET and Java)
        2. Runtime Architecture
        3. The OOP Model
        4. Language Constructs, Syntax, and the API
        5. Summary
      4. Writing Objects
        1. Object Creation
        2. Classes
        3. Constructors
        4. Methods
        5. Fields
        6. Properties
        7. Variable Scoping
        8. Object Destruction
        9. Summary
      5. Understanding Inheritance and Polymorphism
        1. Inheritance
        2. Polymorphism and Virtual Methods
        3. Exploring C# Polymorphism
        4. Methods and Inheritance
        5. Casting
        6. Composition versus Inheritance
        7. Summary
      6. Implementing Interfaces
        1. Basic Interfaces
        2. Multiple Interfaces and Explicit Interface Declaration
        3. Inheritance in Interfaces
        4. The as Operator
        5. Summary
      7. Data Types
        1. The Java Value Type
        2. The Java Reference Type
        3. The C# Value Type
        4. The Built-in Value Types
        5. The C# Reference Types
        6. Boxing and Unboxing
        7. Unsafe Code
        8. Summary
      8. Operators
        1. Arithmetic Operators
        2. Logical Operators
        3. Bitwise Operators
        4. String Concatenation Operators
        5. The Increment and Decrement Operators
        6. Shift Operators
        7. Relational Operators
        8. Assignment Operators
        9. The Member Access (Dot) Operator
        10. The Casting Operator
        11. The Indexing Operator
        12. The Conditional Operator
        13. Object Creation Operator
        14. Type Information Operators
        15. Overflow Exception Control
        16. Pointer Type Operators
        17. Operator Precedence
        18. Operator Overloading
        19. Summary
      9. Essential Control Flow
        1. The if Statement
        2. The while Loop
        3. The do while Loop
        4. The for Loop
        5. The switch Statement
        6. The foreach Statement
        7. Jump Statements
        8. Summary
      10. Programming with Exceptions
        1. Fundamentals of the try-catch-finally Construct
        2. Custom Exceptions
        3. Inheritance and Exceptions
        4. CLR Exceptions
        5. Design Considerations
        6. Summary
      11. Working with Arrays
        1. Java versus C# Arrays
        2. One-Dimensional Arrays
        3. Multidimensional Arrays
        4. Jagged Arrays
        5. Copying Arrays
        6. Arrays as Collections
        7. Summary
      12. Processing Strings
        1. The System.String Class
        2. Initializing Strings
        3. The + Operator and Strings
        4. Regular Expressions
        5. Summary
      13. Formatting Numbers, Strings, and Dates
        1. Formatting
        2. Number Formatting
        3. Date and Time Formatting
        4. Formatting Custom Objects
        5. Parsing
        6. Summary
      14. Using Collections
        1. The System.Collections Interfaces
        2. The System.Collections Classes
        3. Using the System.Collections Classes
        4. Type-Safe Collections
        5. Custom Collections
        6. Summary
      15. Working with the C# I/O API
        1. Streams
        2. The FileStream Class
        3. The BufferedStream Class
        4. The MemoryStream Class
        5. The NetworkStream Class
        6. Readers and Writers
        7. Files and Directories
        8. Serialization
        9. Summary
      16. Thread Programming
        1. The System.Threading Namespace
        2. Creating Threads Using the System.Threading.Thread Class
        3. Stopping a Thread Safely in C#
        4. Thread Synchronization
        5. Interlocked Operations
        6. Summary
      17. Using C# Properties, Indexers, and Attributes
        1. Properties
        2. Indexers
        3. Attributes
        4. Summary
      18. Delegates and Event Programming
        1. Using Delegates
        2. Multicasting
        3. Event Programming
        4. Summary
    4. Advanced C# Topics
      1. Accessing Databases
        1. Inside ADO.NET
        2. JDBC 2.0+
        3. Getting Started with ADO.NET
        4. DataSets
        5. Summary
      2. Processing XML
        1. XML Support in Java
        2. XML and .NET
        3. Reading and Writing XML
        4. Using the DOM API in .NET
        5. Summary
      3. GUI Programming in C#
        1. Choosing a GUI Library: Java or .NET?
        2. Using the IDE to Develop a Small Application
        3. Windows Forms, Component Controls, and Their Associated .NET Classes
        4. Putting It All Together
        5. Anchoring and Docking
        6. Drawing with .NET GUI Classes
        7. Summary
      4. Reflection
        1. The Core Reflection Classes
        2. Browsing and Querying Members
        3. Invoking Methods and Setting Fields and Properties
        4. Generating Dynamic IL Using Reflection Emit
        5. Summary
      5. Assemblies, Application Configuration, and Process Management
        1. The .NET Assembly
        2. Creating an Assembly
        3. Programmatic Access to Assemblies
        4. Versioning
        5. Application Configuration
        6. Process Management
        7. Summary
      6. Java and C# API Comparison
        1. The java.lang Package
        2. The java.util Package
        3. The java.io Package
        4. The java.sql Package
        5. The java.text Package
        6. The org.w3c.dom Package
        7. The javax.swing Package
        8. The java.awt Package