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.
About the Author
Ronald Kevin Burtonhas been around software development for almost 20 years. He has worked with small and efficient real-time executive programs for controlling the flow of communications data in a communications system. He participated in a team to build critical flight-control software, and has worked on Cyber, Unix, VAX/VMS, OS/9, VxWorks, Windows NT, and Windows 2000 systems. Kevin built complex real-time systems that analyzed images and provided feedback to the user, as well as custom software to augment the operation of an electron microscope. Currently, Kevin is working on building cutting edge systems to automate the production and distribution of news broadcasts. He sees the .NET Framework as the next evolution of software development and is excited about being part of that movement. Kevin can be reached at Kevin.Burton@inewsroom.com
Table of Contents
I. .NET FRAMEWORK AND THE CLR FUNDAMENTALS.
1. Introduction to a Managed Environment.
Brief History of the CLR. Overview of the Managed Runtime Environment.
2. The Common Language Runtime-The Language and the Type System.
Common Type System. Features of the Common Language Specification.
3. The Common Language Runtime-Overview of the Runtime Environment.
Introduction to the Runtime. Starting a Method.
II. COMPONENTS OF THE CLR.
4. The Assembly.
Overview of the .NET Assembly. General Assembly Structure. Detailed Assembly Structure. An Unmanaged API to Access Assembly Metadata. Physical Layout of the Assembly.
5. Intermediate Language Basics.
Where Does IL Fit into the Development Scheme? ILDASM Tutorial. Basic IL. Commonly Used IL Instructions.
6. Publishing Applications.
Windows Client Installation Problems. Deploying and Publishing a .NET Application. Identifying Code with Strong Names. Deploying a Private Assembly. Installing Shared Code. Locating Assemblies. Administering Policy.
III. RUNTIME SERVICES PROVIDED BY THE CLR.
7. Leveraging Existing Code-P/Invoke.
Platform Invoke Overview. Why Platform Invoke Interop? Some Other Interop Methods. Details of Platform Invoke. Performance Considerations with P/Invoke.
8. Using COM/COM+ from Managed Code.
The Runtime Callable Wrapper. Programmatically Generating an Interop Assembly. Late-Binding to a COM Component. Interop with ActiveX Controls. Interop with SOAP.
9. Using Managed Code as a COM/COM+ Component.
Why Build a .NET Component to Look Like a COM Component? Unmanaged to Managed Interop Basics.
10. Memory/Resource Management.
Overview of Resource Management in the .NET Framework. Large Objects. WeakReference or Racing with the Garbage Collector.
Threads Overview. What Else Can Be Done to a Thread? AppDomain. Synchronization. Thread Pool.
Brief History of the Distributed Application. Traditional Sockets. WinSock. .NET Networking Classes. .NET Socket. .NET Networking Transport Classes. .NET Protocol Classes. Connection Management. Network Security.
13. Building Distributed Applications with .NET Remoting.
Distributed Applications. Remoting Architecture. Remoting Objects. Advanced Remoting Topics. Debugging Remote Applications.
14. Delegates and Events.
Why delegates? delegate Basics. Comparing delegates. Removing delegates. Cloning delegates. Serializing delegates. Asynchronous delegates. events Make Working with delegates Easier.
15. Using Managed Exceptions to Effectively Handle Errors.
Error Handling with Exceptions. Exceptions Overview. C# Exceptions. VC++ Exceptions. VB Exceptions. Cross Language Exceptions. P/Invoke Exceptions. COM Exceptions. Remote Exceptions. Thread and Asynchronous Callback Exceptions.
16. .NET Security.
Two Different, Yet Similar Security Models. Isolated Storage. Using .NET Cryptography.
Using Reflection to Obtain Type Information. Using Reflection to Serialize Types. Late Binding to an Object Using Reflection. Dynamic Generation of Code.
International Application Basics. The Road to an International Application.
19. Debugging .NET Applications.
Providing Feedback to the User. Using a Debugger. Determining Assembly Load Failures. Building Your Own Debugger.
20. Profiling .NET Applications.
Traditional Tools Used in Profiling a .NET Application. Using the Performance Monitor and PerformanceCounters to Profile .NET Applications. Using Custom Profiling APIs.
Appendix A. C# Basics.
Building a Program with C#. Object-Oriented Programming with C#. C# Objects. Basic Programming Elements of C#.
Appendix B. .NET Framework Class Libraries.
System.BitConverter. System.Buffer. System.Console. System.Convert. System.DateTime. System.Environment. System.Guid. System.IFormatProvider. System.Math. System.OperatingSystem. System.Random. System.TimeSpan. System.TimeZone. System.Version. System.Collections. System.ComponentModel. System.Configuration. System.Data. System.Diagnostics. System.Drawing. System.IO. System.Messaging. System.Text. System.Timers. System.Web. System.Windows.Forms. System.Xml.
Appendix C. Hosting the Common Language Runtime.
Adding a Custom Host for the Common Language Runtime.
Appendix D. The Common Language Runtime as Compared to the Java Virtual Machine.
Historical Backdrop of the War of Who Will Manage Your Code. Java Versus .NET Languages. Java Versus C#. Taking into Account Your Company and Your Employees.
Appendix E. Additional References.
Chapter 2 References. Chapter 3 References. Chapter 4 References. Chapter 5 References. Chapter 6 References. Chapter 7 References. Chapter 8 References. Chapter 9 References. Chapter 10 References. Chapter 11 References. Chapter 12 References. Chapter 13 References. Chapter 14 References. Chapter 16 References. Appendix A References. Appendix B References. Appendix D References.