The Concurrent Collection Classes........................................................... 818
Index 823
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you. To participate in a brief online survey, please visit:
Xx Contents
Foreword
W
ell, here we are again. Who would’ve thought? Oh, I know—I would’ve thought!
When you sign up for marriage, you really are living Groundhog Day. If you haven’t seen that movie, watch it, because you will suddenly see why you have to make the same mistakes over and over again. In this case, when Jeff said he wouldn’t write another book, I knew it was the empty promise of an addict. Jeff cannot not write another book. Just today, we were discussing another book he is absolutely not going to write (except that there is already a chapter in progress). It is coded in his DNA. A thoroughbred is born to run and Jeff is born to write.
Jeff is as predictable as the seasons. He cannot stay away from the little 0s and 1s locked inside his hard drive. They cannot be ignored. And while the rest of you are all snug in your beds, Jeff’s internal alarm starts ringing around 3:00 a.m. (coincidently, when our four-year-old climbs into bed with us, another pattern I seem to have no control over) some mysterious force compels Jeff’s brain to unlock little solutions, big brainstorms, and frightening bugs that control him. It forces him into his office to work them out of his head. The rest of us can roll over and go back to sleep, safe, knowing that Jeff is out there somewhere solving these problems for us—like a cyber-super hero, saving the thread from becoming just another loose end.
But accruing this knowledge just for himself is not enough for Jeff. He feels selfish hoarding his insights in his little space in the universe. So he must broadcast them; he must write them down. They're like radio waves hurling outward wondering if a listener will pick them up. This he does for you, dear reader; a testament to his passion for Microsoft technologies.
This book is actually adding a new layer of wisdom. Jeff is getting older each time he flies around the sun, and with the accumulation of years, he is starting to look back. Thinking about things in a more mature manner, he has rewritten the chapter cover- ing Reflection. Maybe you too will join him as he waxes poetic on this subject. This is a place where we can learn how to have the code ask about the code and really encour- aging some deeper insights as to why Reflection works the way it does. Put on your smoking jackets, sink into a leather chair, and spend some time thinking about your own code and its greater purpose in life.
On a more lively note, there is stuff about async/await in here. Apparently, this is the progression of the AsyncEnumerator my love has been going on about for some time. Whew, I didn’t think we would ever move on from that! The thing is, as many times as he has talked about his AsyncEnumerator, it hasn’t stuck in my mind at all. I decided if
I knew what enumerator meant, maybe this would help me. According to Wikipedia, it is a census taker. Is this chapter about census takers working out of synchronicity? That seems like a waste of taxpayer dollars. Whatever it means in the computer world must be better than that. Jeff worked with the team at The Big M to perfect async/await, and now it is here in this book laid out for your reading pleasure; I suggest you read it sequentially.
Another major addition to the book is the one I’m most excited about. It is my expectation of you all to read and internalize this WinRT stuff. This is a nerd word that somehow means: “Make Me Really Cool Apps for Some Awesome Slate Device NOW!” That’s right; the new Windows Runtime is all about awesome touch screens. My kids would like some birds that fly into pigs. I would like maybe something with flowers, and definitely you could use it for some educational stuff. Just let your imagination go! Come up with Wonderful Innovative Nifty Really Touchy stuff. Use this chapter for my benefit, please. Otherwise, I may run out of patience with Jeff and his continuous book writing and lock him in a room with knitting needles and no electricity. You program- mers decide: write cool apps with WinRT or no new books from Jeff!
In summary, with your continued patronage, Jeff has delivered yet another mas- terpiece. Our family can return to a more normal state. Which is what, really? I think maybe normal is the book writing state.
Ever patiently awaiting the siren call of yet another book, Kristin Trace (Jeff’s wife)
October 2012
Help! Please save Jeff from the knitting!
Introduction
I
t was October 1999 when some people at Microsoft first demonstrated the Microsoft
.NET Framework, the common language runtime (CLR), and the C# programming language to me. The moment I saw all of this, I was impressed and I knew that it was going to change the way I wrote software in a very significant way. I was asked to do some consulting for the team and immediately agreed. At first, I thought that the .NET Framework was an abstraction layer over the Win32 API and COM. As I invested more and more of my time into it, however, I realized that it was much bigger. In a way, it is its own operating system. It has its own memory manager, its own security system, its own file loader, its own error handling mechanism, its own application isolation bound- aries (AppDomains), its own threading models, and more. This book explains all these topics (and more) so that you can effectively design and implement software applica- tions and components for this platform.
It is October 2012 as I write this text, making it 13 years now that I’ve worked with the .NET Framework and C#. Over the 13 years, I have built all kinds of applications and, as a consultant to Microsoft, have contributed quite a bit to the .NET Framework itself. As a partner in my own company, Wintellect (http://Wintellect.com), I have worked with numerous customers to help them design software, debug software, performance-tune software, and solve issues they have with the .NET Framework. All these experiences have really helped me learn the spots that people have trouble with when trying to be productive with the .NET Framework. I have tried to sprinkle knowledge from these experiences through all the topics presented in this book.