About C++/CLI on .NET 2.0
Getting C++ to work under .NET was no easy task. The first time this was attempted with .NET 1.0 was called Managed Extensions but that didn't set the world on fire. Under .NET 2.0 it's now completely different and is called C++/CLI. The designers have learnt a few lessons from the first attempt.If you have a large chunk of C++ code that runs on Win 32 and you wish to run it under .NET there are several options. You could link to it as unmanaged code, or you could rewrite it in C# or other native .NET languages or you could rewrite it in C++/CLI to take advantage of managed code. If you choose the latter option, you need a pretty technical overview of C++/CLI and that is what this book provides. It's one of only three or four books that deals with this subject.
Why is there such a problem with C++ on .NET?
In a nutshell, pointers. .NET's code is managed by the .NET Framework. This means no pointers, and no possibility of memory being overwritten accidentally. Fitting C++ into the .NET managed code world requires it to work within the framework's memory management, code security and garbage collection. These are all features that prior to .NET, were coded by the developer, if at all.Fraser introduces all this with a "view from 30,000 feet"; a very comprehensive overview that is certainly needed to introduce a fairly complex area of development. He also points out that C++/CLI cannot be used for .NET web application development anymore (though web services are allowed).
Writing Managed C++ Code
In chapter two the differences are highlighted in more detail- for example CLI enums and C++ enums are not the same. It becomes apparent very quickly that if you want to write safe managed code in C++, you need to think a lot more about your code. On the plus side you get new statements like for each.The book moves quickly on into advanced territory. It's a mixture of explaining standard C++ features and how to work with .NET. Beginners to programming would probably feel quite a way out of their depth, this is certainly not a beginners book- it is for professionals as reflected by the title. C++ has its complicated bits and C++/CLI is even worse. Not only do you have templates but you also have generics which are subtly different. The book is bulked up by the sheer quantity of example code but without it, the subject would have been very heavy going. 850 Pages makes for a lot of reading!
To Finish Off
The rest of this section covers XML, ADO for connecting to databases, web services, multi threading, network programming, assembly programming and security in 300 pages.Finally the last two chapters looks at unsafe C++ which includes pointers and calling COM servers.





