(The Other) Top 10 Changes in C# Beta 2

C# Beta 2 incorporates a number of changes from Beta 1 as Microsoft polishes the language for its Release-To-Manufacturing date. Review the most significant of these syntactical, compiler, and behavioral changes.

by Michael Lane Thomas

Jul 18, 2001

Page 1 of 2

s the first new commercial language Microsoft has introduced since Visual Basic 1.0 in 1991 (FoxPro was acquired in June 1992), C# is quickly garnering heavy attention from interested spectators and hardcore developers alike. Beta 2 (released on June 18) incorporates a number of changes as Microsoft polishes the language for a projected Release-To-Manufacturing date near the end of 2001.

In this second article of a two-part series, I introduce another ten important changes found in C# Beta 2. If you haven't read Part I of the Top 10 Changes in C# Beta 2 series yet, don't worry; you can read the articles in any order. Developers already familiar with Beta 1 should be aware of the changes detailed in both articles.

#1Use of Backtick and $ for Identifying Verbatim Strings No Longer Supported
Although Beta 1 C# (§2.5.3.5) and Beta 2 (§2.4.4.5) documentation for string literals both correctly specify a verbatim string literal as consisting of a @ character followed by zero or more characters enclosed in double-quotes, Beta 1 supported the use of the backtick (`) in place of the @ character. Beta 1 also supported the use of the $ character for verbatim string literals as a substitute for the double-quote, when used in conjunction with the backtick. Beta 2 no longer supports the use of the backtick or the $ character when specifying a verbatim string literal.

#2Arrays with Unknown Ranks Are Not Supported by the Compiler
In Beta 1, use of the feature 'array of unknown rank' generated a compiler warning regarding deprecation, but it compiled and functioned. In Beta 2, this feature has been eliminated.

#3Assemblies Now Assumed to Be CLS Non-Compliant
Prior to Beta 2, the C# compiler assumed that all assemblies not explicitly marked with the [CLSCompliant(false)] attribute were compliant with the Common Language Specification (CLS). The C# language specification indicates that a library without an explicit CLSCompliant attribute setting of True should be assumed non-compliant. This C# compiler behavior has been corrected in Beta 2. To mark an assembly as being CLS-compliant now requires an explicit use of the attribute.

#4Syntax for Event Accessors Now Consists of Add and Remove Accessor Declarations
Previously, explicit event accessor declarations followed the same syntax as property declarations. A Get and Set accessor was used to obtain and set the delegate value with an object key. Beta 2 modified the behavior of event accessor declarations in C# to map more intuitively to the behavior of adding and removing delegates to the event sink list.