C#- New features Modern


The effort you put into learning C# is a great investment because C# was designed to be the premier language for writing NGWS applications. You will find many features that you had to implement yourself in C++, or that were simply unavailable, are part of the base C# language implementation.

The financial types are a welcome addition for an enterprise-level programming language. You get a new decimal data type that is targeted at monetary calculations. If you are not fond of the provided simple types, you can easily create new ones specifically crafted for your application.

I have already mentioned that pointers are no longer part of your programming weaponry. You won't be too surprised then that the entire memory management is no longer your duty—the runtime of NGWS provides a garbage collector that is responsible for memory management in your C# programs. Because memory and your application are managed, it is imperative that type safety be enforced to guarantee application stability.

It is not exactly news to C++ programmers, but exception handling is a main feature of C#. The difference from C++, however, is that exception handling is cross-language (another feature of the runtime).Prior to C#, you had to deal with quirky HRESULTs—this is now over because of robust error handling that is based on exceptions.

Security is a top requirement for a modern application. C# won't leave you alone on this either: It provides metadata syntax for declaring capabilities and permissions for the underlying NGWS security model. Metadata is a key concept of the NGWS runtime, and the next chapter deals with its implications in more depth.