.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(R) .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(R) .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 .N
ET 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:
Preface.
I. C# ESSENTIALS.
1. The .NET Framework.
What Is .NET?
NET Framework Terminology and Core Concepts.
CLR.
Managed Code.
MSIL.
Assembly.
Application Domain.
Runtime Host.
The Common Type System.
Common Language Specification.
CLR and the JVM.
.NET MSIL.
.NET JIT.
The Java Virtual Machine.
Memory Management.
Garbage Collection in the CLR.
Garbage Collection in the JVM.
Security Management.
Policy-Driven Security Based on Code Evidence.
Role-Based Security, Authentication, and Authorization.
Isolated Storage.
Cryptography.
Security in Java.
Exception Management.
Exception Management in the CLR.
Exception Management in Java.
Overview of the .NET Framework Class Library.
Summary.
Chapter 2 Starting with C#.
The .NET SDK.
Writing Your First C# Program.
C# Performance.
C# Tools.
Visual Studio .NET.
The Intermediate Language Disassembler.
Summary.
3. C# and Java: What Is the Difference?
Programming Platforms (.NET and Java).
The Java Platform.
The .NET Suite.
The Presentation Layer.
The Business Logic Layer.
The Data Layer.
Runtime Architecture.
The JVM.
The CLR.
ASP.NET.
Internet Explorer.
Shell Executables.
The OOP Model.
Language Constructs, Syntax, and the API.
Data Types.
Operators.
Control Flow Statements.
Exception Support.
Common Objects.
Common Language Elements.
Collections Library.
Threading.
Input/Output.
Namespaces and Assemblies.
What's Missing from Java?
What's Missing from C#?
Summary.
4. Writing Objects.
Object Creation.
The C# Equivalent of java.lang.Object.
Classes.
Class Modifiers.
Class Access Modifiers and Inheritance.
Constructors.
Methods.
public.
protected.
private.
internal.
static.
sealed.
extern.
unsafe.
virtual.
override.
abstract.
new.
Method Inheritance.
Method Overloading.
Method Parameters.
Fields.
public.
private.
protected.
internal.
const.
readonly.
static. BHEADS = volatile.
Properties.
Inheritance and Properties.
Variable Scoping.
Object Destruction.
Summary.
5. Understanding Inheritance and Polymorphism.
Inheritance.
Polymorphism and Virtual Methods.
Exploring C# Polymorphism.
Using the virtual and override Keywords.
Effects of Method Parameters and Conversion Rules.
Methods and Inheritance.
Access Modifiers.
The base Keyword.
Static Methods and Inheritance.
Abstract Methods and Inheritance.
Casting.
Composition versus Inheritance.
Summary.
6. Implementing Interfaces.
Basic Interfaces.
Differences between C# and Java Interfaces.
Multiple Interfaces and Explicit Interface Declaration.
Inheritance in Interfaces.
The as Operator.
Summary.
7. Data Types.
The Java Value Type.
The Java Reference Type.
The C# Value Type.
The struct Type.
The enum Type.
The Built-in Value Types.
Built-in Integral Value Types.
The Built-in Floating-Point Types.
The Built-in Decimal Value Types.
The Built-in Boolean Value Types.
Explicit Conversions.
The C# Reference Types.
Boxing and Unboxing.
Boxing.
Unboxing.
The typeof Operator.
Unsafe Code.
The Pointer Data Type.
Summary.
8. Operators.
Arithmetic Operators.
Logical Operators.
Bitwise Operators.
The & Operator.
The | Operator.
The ^ Operator.
The ~ Operator.
String Concatenation Operators.
The Increment and Decrement Operators.
Shift Operators.
The << Operator.
The >> Operator.
Relational Operators.
The == Operator.
The != Operator.
The < Operator.
The > Operator.
The <= Operator.
The >= Operator.
Assignment Operators.
The = Operator.
The += Operator.
The -= Operator.
The *= Operator.
The /= Operator.
The %= Operator.
The &= Operator.
The |= Operator.
The ^= Operator.
The >>= Operator.
The <<= Operator.
The Member Access (Dot) Operator.
The Casting Operator.
The Indexing Operator.
The Conditional Operator.
Object Creation Operator.
Type Information Operators.
The is Operator.
The as Operator.
The sizeof Operator.
The typeof Operator.
Overflow Exception Control.
The checked Operator.
The unchecked Operator.
Pointer Type Operators.
Operator Precedence.
Operator Overloading.
Summary.
9. Essential Control Flow.
The if Statement.
The while Loop.
The do while Loop.
The for Loop.
The switch Statement.
The foreach Statement.
Jump Statements.
Summary.
10. Programming with Exceptions.
Fundamentals of the try-catch-finally Construct.
Custom Exceptions.
Inheritance and Exceptions.
CLR Exceptions.
Design Considerations.
Let It Throw.
Catch, Clean Up, and Rethrow.
Catch, Clean Up, and Rethrow as a Different Exception.
Summary.
11. Working with Arrays.
Java Versus C# Arrays.
Java Arrays.
C# Arrays.
One-Dimensional Arrays.
Multidimensional Arrays.
Jagged Arrays.
Copying Arrays.
Arrays as Collections.
Summary.
12. Processing Strings.
The System.String Class.
Initializing Strings.
The + Operator and Strings.
Regular Expressions.
Summary.
13. Formatting Numbers, Strings, and Dates.
Formatting.
Number Formatting.
Currency Formatting.
Scientific Formatting.
Number, Fixed-Point, and General Formatting.
Percent Formatting.
Custom Specifiers.
Section, Hexadecimal, and Escaping Specifiers.
Date and Time Formatting.
Formatting Custom Objects.
Parsing.
Summary.
14. Using Collections.
The System.Collections Interfaces.
The System.Collections Classes.
Thread Safety.
Type Safety.
Immutability.
Accessibility.
Using the System.Collections Classes.
ArrayList.
BitArray.
Hashtable.
Queue. BHEADS = Stack.
SortedList.
Icomparer.
IhashCodeProvider.
Ienumerator.
Type-Safe Collections.
Custom Collections.
Summary.
15. Working with the C# I/O API.
Streams.
The FileStream Class.
The BufferedStream Class.
The MemoryStream Class.
The NetworkStream Class.
Readers and Writers.
Files and Directories.
AppendText.
Exists, Copy, Move, and Delete.
Open, OpenWrite, OpenText, and OpenRead.
Asynchronous I/O.
Serialization.
Basic Serialization.
Custom Serialization.
Summary.
16. Thread Programming.
The System.Threading Namespace.
Creating Threads Using the System.Threading.Thread Class.
Starting a Thread.
The Life Cycle of a Thread.
Stopping a Thread Safely in C#.
Creating Threads Using the System.Threading.ThreadPool Class.
Creating Threads Using the System.Threading.Timer Class.
Creating Threads Using the Asynchronous Callback.
Thread Synchronization.
The ReaderWriterLock Class.
Interlocked Operations.
Summary.
17. Using C# Properties, Indexers, and Attributes.
Properties.
Indexers.
Indexers with an Integer Index.
Indexers with a String Index.
Indexers with Multiple Indices.
Attributes.
Summary.
18. Delegates and Event Programming.
Using Delegates.
Multicasting.
Event Programming.
Summary.
II. ADVANCED C# TOPICS.
19. Accessing Databases.
Inside ADO.NET.
JDBC 2.0+.
Getting Started with ADO.NET.
Establishing a Connection to the Database.
Running a SELECT Query and Getting Data.
Running an INSERT, UPDATE, or DELETE Query.
Running a Stored Procedure.
Processing Transactions.
Exploring Database Metadata.
DataSets.
Loading Data into a DataSet.
Saving Data to the RDBMS Using a DataSet.
Summary.
20. Processing XML.
XML Support in Java.
XML and .NET.
Reading and Writing XML.
Reading XML in .NET.
Writing XML in .NET.
Using the DOM API in .NET.
Xpath.
XSLT.
Summary.
21. GUI Programming in C#.
Choosing a GUI Library: Java or .NET?
Using the IDE to Develop a Small Application.
Step 1: Creating a New Project.
Step 2: Designing the Form.
Step 3: Modifying the Form.
Windows Forms, Component Controls, and Their Associated .NET Classes.
Putting It All Together.
What the Application Does.
Source Files of the Application.
The Application Controls.
Anchoring and Docking.
Anchoring.
Docking.
Drawing with .NET GUI Classes.
System.Drawing.
Double Buffering.
Sample Drawing Program.
Summary.
22. Reflection.
The Core Reflection Classes.
Browsing and Querying Members.
Invoking Methods and Setting Fields and Properties.
Generating Dynamic IL Using Reflection Emit.
Summary.
23. Assemblies, Application Configuration, and Process Management.
The .NET Assembly.
The Assembly Manifest.
Modules.
Resources.
Creating an Assembly.
Programmatic Access to Assemblies.
Versioning.
Application Configuration.
Single-Tag Section.
Name/Value Section.
Dictionary Section.
A Sample Config File.
Process Management.
Querying the Current Application Domain.
Executing an Application in a Remote Application Domain.
Invoking a Method in a Remote Application Domain.
Querying Processes.
Creating and Killing Processes.
Redirecting Process Output.
Detecting Process Completion.
Exiting a Process.
Summary.
Appendix: Java and C# API Comparison.
The java.lang Package.
The java.util Package.
The java.io Package.
The java.sql Package.
The java.text Package.
The org.w3c.dom Package.
The javax.swing Package.
The java.awt Package.
Index.