4 Login   4 Register Account    

 
 

 
 

 
 
 

 
 
 
 

 
 




Programming Microsoft Visual C# 2005 : The Base Class Library

A complete reference to the most important types in the BCL, including streams, reflection, generics, arrays, collection, memory management, object serialization, interoperability.


 Printer friendly version

While there are tons of books about the C# language and, of course, even more books on the high-level portions of the .NET Framework - such as Windows Forms, ADO.NET, and ASP.NET – I found that very few textbooks cover the .NET Base Class Library (or BCL) with the level of detail that is required by the professional developer. Worst, while many books explain what a given language or framework feature is, they often fail to give you some practical and non-trivial examples of how you can put it to good use.

For all these reasons, in the middle of 2005 I proposed Microsoft Press to write a book on C# and the BCL, using the material that I wrote for the second half of my Programming Microsoft Visual Basic 2005: The Language. Thus I discarded the chapters that covered the VB language, revised the contents to adapt to C# and the way a C# developer thinks, and of course converted all the code samples, using C# specific features – such as iterators and anonymous methods – whenever possible.

However, this 600-page book isn't just a BCL reference from the perspective of a C# developer. Better, in addition to being a complete reference book, it is a digest of the many programming techniques that you can implement by leveraging the features of the language and the .NET Framework 2.0, including generics, threads, reflection, custom attributes, serialization, delegate, regular expressions, and more. All descriptions aim to writing faster and more robust code. I looked hard for a similar book on the market before writing this one. I believe I finally wrote a book that does VB justice.

To give you an idea of what this book covers, and at which level of detail, I am uploading a couple of sample chapters: Chapter 5, “Arrays and Collections” and Chapter 10, “Custom Attributes”.

You can download the complete source code of all samples here

This doc file contains errata for typos and mistakes found after going to print.

Read readers' reviews and buy from Amazon at 37% off ($28.34 instead of $44.99).


Here’s the Table of Contents, with a short description of what you can find in each chapter:

1. NET Basic Types (50 pages): working with strings, numbers, and dates at their best, including many little/big new features of .NET 2.0
2. Object Lifetime (30 pages): many details on the garbage collector, the Dispose-Finalize method, and how to optimize memory-intensive apps.
3. Interfaces (24 pages): how to leverage the most important interfaces defined in the .NET Framework, including IComparable, IComparer, and IEnumerable, with a digression on iterators in C# 2005.
4. Generics (42 pages): all you need to know to leverage this great new feature of the C# language and the .NET Framework.
5. Arrays and Collections (54 pages): arrays, jagged arrays, "traditional" and generics collections, plus many tricks for writing less code that runs faster.
6. Regular Expressions (42 pages): a reference of regex syntax, plus many practical examples on data validation, data parsing, and even a full-featured expression evaluator. If you aren't familiar with regexs you are missing a great occasion for writing better code in less time.
7. Files, Directories, and Streams (42 pages): an overview of all the types in System.IO and the many new features in .NET 2.0, including ACL support, compressed streams, and the TextFieldParser type.
8. Assemblies and Resources (50 pages): despite of their importance, resources (either simple or localized) are used rarely and unproperly by most developers; this chapter includes a complete description of the many important features added to NGEN.
9. Reflection (66 pages): there is a lot to say about reflection; among the many examples I wrote an app that generates code on the fly, a scheduler for undoable actions, and a universal comparer class.
10. Custom Attributes (52 pages): this chapter includes a few complete and nontrivial examples of how a custom attribute can make your coding simpler, for example by means of Windows Forms plugins and a framework for n-tier apps.
11. Threads (58 pages): the Thread object, asynchronous delegates, thread pool, the SyncLock statement, all the synchronization types, including the new Semaphore. Plus a section on threading in Windows Forms
12. Object Serialization (36 pages): binary and SOAP serialization, version-tolerant serialization in .NET 2.0, the new attributes for serializatoin, custom serialization, serialization surrogates, the IObjectReference interface, and more.
13. PInvoke and COM Interop (40 pages): How to interact with unmanaged code: calling "classic" DLL and Windows API methods; using COM components (including the new registration-free components); writing .NET components that can be used from COM apps.

 

Francesco Balena - Code Architects Srl vai al blog dell'autore     scrivi una e-mail all'autore

Subscribe to the free .NET-2-The-Max newsletter to read additional material not available online. Click here.