?– Static classes??”Tidying up utility classes so that the compiler can make it clearer
when you??™re trying to use them inappropriately.
?– Separate getter/setter property access??”Finally, the ability to have a public getter and
a private setter for properties! (That??™s not the only combination available, but
it??™s the most common one.)
?– Namespace aliases??”Ways out of sticky situations where type names aren??™t unique.
?– Pragma directives??”Compiler-specific instructions for actions such as suppressing
specific warnings for a particular section of code.
?– Fixed-size buffers??”More control over how structs handle arrays in unsafe code.
?– InternalsVisibleToAttribute (friend assemblies)??”A feature spanning library, framework,
and runtime, this allows selected assemblies more access when required.
You may well be itching to get on to the sexy stuff from C# 3 by this point, and I don??™t
blame you. Nothing in this chapter is going to set the world on fire??”but each of these
features can make your life more pleasant, or dig you out of a hole in some cases. Having
dampened your expectations somewhat, our first feature is actually pretty nifty.
7.1 Partial types
The first change we??™ll look at is due to the power struggle that was usually involved
when using code generators with C# 1. For Windows Forms, the designer in Visual Studio
had to have its own regions of code that couldn??™t be touched by developers, within
the same file that developers had to edit for user interface functionality.
Pages:
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364