O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

.NET Common Language Runtime Unleashed

Book Description

The .NET Framework provides a runtime environment called the Common Language Runtime, which manages the execution of code and provides services that make the development of robust software easier. The Common Language Runtime (CLR) provides a solid foundation for developers to build various types of applications. Whether a developer is writing an ASP.NET application, a Windows Forms application, a Web Service, a mobile code application, a distributed application, or an application that combines several of these application models, the CLR provides huge benefits such as simplified development and the ability to integrate code written in various languages.

This book is a high-end comprehensive reference to the capability of the CLR. The samples in the book have been written so that they not only illustrate a principle but give the reader a springboard to quickly translate the sample to practical, real-world applications. After reading this book, readers will be able to significantly increase their productivity by comfortably using the power and expressiveness of the Common Language Runtime in their applications. This book will take the reader beyond the syntax of C# to using and understanding the CLR to build secure, maintainable, and high performance applications.

Table of Contents

  1. Copyright
  2. Foreword
  3. About the Author
  4. Acknowledgments
  5. Tell Us What You Think!
  6. Introduction
  7. .NET Framework and the CLR Fundamentals
    1. Introduction to a Managed Environment
      1. Brief History of the CLR
      2. Overview of the Managed Runtime Environment
      3. Summary
    2. The Common Language Runtime—The Language and the Type System
      1. Common Type System
      2. Features of the Common Language Specification
      3. Summary
    3. The Common Language Runtime—Overview of the Runtime Environment
      1. Introduction to the Runtime
      2. Starting a Method
      3. Summary
  8. Components of the CLR
    1. The Assembly
      1. Overview of the .NET Assembly
      2. General Assembly Structure
      3. Detailed Assembly Structure
      4. An Unmanaged API to Access Assembly Metadata
      5. Physical Layout of the Assembly
      6. Summary
    2. Intermediate Language Basics
      1. Where Does IL Fit into the Development Scheme?
      2. ILDASM Tutorial
      3. Basic IL
      4. Commonly Used IL Instructions
      5. Summary
    3. Publishing Applications
      1. Windows Client Installation Problems
      2. Deploying and Publishing a .NET Application
      3. Identifying Code with Strong Names
      4. Deploying a Private Assembly
      5. Installing Shared Code
      6. Locating Assemblies
      7. Administering Policy
      8. Summary
  9. Runtime Services Provided by the CLR
    1. Leveraging Existing Code—P/Invoke
      1. Platform Invoke Overview
      2. Why Platform Invoke Interop?
      3. Some Other Interop Methods
      4. Details of Platform Invoke
      5. Performance Considerations with P/Invoke
      6. Summary
    2. Using COM/COM+ from Managed Code
      1. The Runtime Callable Wrapper
      2. Programmatically Generating an Interop Assembly
      3. Late-Binding to a COM Component
      4. Interop with ActiveX Controls
      5. Interop with SOAP
      6. Summary
    3. Using Managed Code as a COM/COM+ Component
      1. Why Build a .NET Component to Look Like a COM Component?
      2. Unmanaged to Managed Interop Basics
      3. Summary
    4. Memory/Resource Management
      1. Overview of Resource Management in the .NET Framework
      2. Large Objects
      3. WeakReference or Racing with the Garbage Collector
      4. Summary
    5. Threading
      1. Threads Overview
      2. What Else Can Be Done to a Thread?
      3. AppDomain
      4. Synchronization
      5. Thread Pool
      6. Summary
    6. Networking
      1. Brief History of the Distributed Application
      2. Traditional Sockets
      3. WinSock
      4. .NET Networking Classes
      5. .NET Socket
      6. .NET Networking Transport Classes
      7. .NET Protocol Classes
      8. Connection Management
      9. Network Security
      10. Summary
    7. Building Distributed Applications with .NET Remoting
      1. Distributed Applications
      2. Remoting Architecture
      3. Remoting Objects
      4. Advanced Remoting Topics
      5. Debugging Remote Applications
      6. Summary
    8. Delegates and Events
      1. Why delegates?
      2. delegate Basics
      3. Comparing delegates
      4. Removing delegates
      5. Cloning delegates
      6. Serializing delegates
      7. Asynchronous delegates
      8. events Make Working with delegates Easier
      9. Summary
    9. Using Managed Exceptions to Effectively Handle Errors
      1. Error Handling with Exceptions
      2. Exceptions Overview
      3. C# Exceptions
      4. VC++ Exceptions
      5. VB Exceptions
      6. Cross Language Exceptions
      7. P/Invoke Exceptions
      8. COM Exceptions
      9. Remote Exceptions
      10. Thread and Asynchronous Callback Exceptions
      11. Summary
    10. .NET Security
      1. Two Different, Yet Similar Security Models
      2. Isolated Storage
      3. Using .NET Cryptography
      4. Summary
    11. Reflection
      1. Using Reflection to Obtain Type Information
      2. Using Reflection to Serialize Types
      3. Late Binding to an Object Using Reflection
      4. Dynamic Generation of Code
      5. Summary
    12. Globalization/Localization
      1. International Application Basics
      2. The Road to an International Application
      3. Summary
    13. Debugging .NET Applications
      1. Providing Feedback to the User
      2. Using a Debugger
      3. Determining Assembly Load Failures
      4. Building Your Own Debugger
      5. Summary
    14. Profiling .NET Applications
      1. Traditional Tools Used in Profiling a .NET Application
      2. Using the Performance Monitor and PerformanceCounters to Profile .NET Applications
      3. Using Custom Profiling APIs
      4. Summary
  10. Appendixes
    1. C# Basics
      1. Building a Program with C#
      2. Object-Oriented Programming with C#
      3. C# Objects
      4. Basic Programming Elements of C#
    2. .NET Framework Class Libraries
      1. System.BitConverter
      2. System.Buffer
      3. System.Console
      4. System.Convert
      5. System.DateTime
      6. System.Environment
      7. System.Guid
      8. System.IFormatProvider
      9. System.Math
      10. System.OperatingSystem
      11. System.Random
      12. System.TimeSpan
      13. System.TimeZone
      14. System.Version
      15. System.Collections
      16. System.ComponentModel
      17. System.Configuration
      18. System.Data
      19. System.Diagnostics
      20. System.Drawing
      21. System.IO
      22. System.Messaging
      23. System.Text
      24. System.Timers
      25. System.Web
      26. System.Windows.Forms
      27. System.Xml
    3. Hosting the Common Language Runtime
      1. Adding a Custom Host for the Common Language Runtime
    4. The Common Language Runtime as Compared to the Java Virtual Machine
      1. Historical Backdrop of the War of Who Will Manage Your Code
      2. Java Versus .NET Languages
      3. Java Versus C#
      4. Taking into Account Your Company and Your Employees
    5. Additional References
      1. Chapter 2 References
      2. Chapter 3 References
      3. Chapter 4 References
      4. Chapter 5 References
      5. Chapter 6 References
      6. Chapter 7 References
      7. Chapter 8 References
      8. Chapter 9 References
      9. Chapter 10 References
      10. Chapter 11 References
      11. Chapter 12 References
      12. Chapter 13 References
      13. Chapter 14 References
      14. Chapter 16 References
      15. Appendix A References
      16. Appendix B References
      17. Appendix D References
  11. Index