By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
By Brent Sheets, Site Editor of SearchVB.com.
By now, unless you've been living under a rock in Mongolia, you've probably heard about a new programming language, called C# (pronounced: C Sharp). C# is a simple, object oriented language attempting to merge the ease of Visual Basic with the power of C++.
Whether Microsoft can garner crucial developer interest for its new language remains to be seen, but if you're curious about C#, keep reading for a free way to learn more.
The first book I've seen on this subject is by Christoph Wille, called Presenting C# (published by Sams Publishing). The first three chapters are currently published online on informIT. Every other week, informIT will publish three additional chapters of the book. You can whet your appetite with the excerpt below that delves into the NGWS runtime environment.
The NGWS Runtime
You are provided with a runtime environment by NGWS, the NGWS runtime. This runtime manages the execution of code, and it provides services that make programming easier. As long as the compiler that you use supports this runtime, you will benefit from this managed execution environment.
Your guess-that the C# compiler supports the NGWS runtime -is correct. However, it is not the only compiler that supports the NGWS runtime; Visual Basic and C++ do so also. The code that these compilers generate for NGWS runtime support is called managed code. The benefits your applications gains from the NGWS runtime are
- Cross-language integration (through the Common Language Specification)
- Automatic memory management (garbage collection)
- Cross-language exception handling (unified unwinding)
- Enhanced security (including type safety)
- Versioning support (the end of "DLL hell")
- Simplified model for component interaction
For the NGWS runtime to provide all these benefits, the compiler must emit metadata along with the managed code. The metadata describes the types in your code, and is stored along with your code (in the same PE- portable executable-file).
As you can see from the many cross-language features, he NGWS runtime is mainly about tight integration across multiple different programming languages. This support goes as far as allowing you to derive a C# class from a Visual Basic object (given that certain prerequisites that I'll discuss later are met).
One feature that C# programmers will like is that they don't have to worry about memory management-namely the all-famous memory leaks. The NGWS runtime provides the memory management, and the garbage collector releases the objects or variables when their lifetimes are over-when they are no longer referenced. I really like this feature because memory management in COM was my personal bane.
There are even bonuses when deploying a managed application or component. Because managed applications contain metadata, the NGWS runtime can use this information to ensure that your application has the specified versions of everything it needs. The net result is that your code is less likely to break because some dependency is not met. Another advantage of the metadata approach is that type information resides in the same file where the code resides-no more problems with the Registry!
To read the first three chapters of Christoph Wille's book Presenting C#, click over to InformIT.com. Registration is required on InformIT, but it's free.