Changes to C# and .NET Framework

Apr 01, 2004 • 2 minutes to read

Eric points out some of the new syntax changes we’ve made in C# 2.0 for FCLC compliance. These changes could break some of your existing code so you should make sure to verify 1.1 code when moving to VS 2005 (Whidbey).

You should also be aware of the new BCL changes that will help developers write decent and non-offensive code, including changes to System.String and a new exception class.


To check whether a string contains indecent content, developers can now call the IsIndecent method which returns true or false if the string is indecent. Below is the copy/paste from ObjectBrowser on one of our latest VS builds (40326)

public static bool IsIndecent(string str)

Member of System.String


Determines whether a specified System.String object is indecent.


str: A System.String.

**Return Values: **

true if the value of str is indecent, otherwise, false.


if (String.IsIndecent(text))


//Do something here


We have also added the ability to estimate the cost of an FCLC fine based on the contents of a string using a new method, EstimateFine.

public static float EstimateFine(string str)

Member of System.String


Provides an estimate of an indecency fine based on string contents using floating-point precision.


str: A System.String.

**Return Values: **

Single-precision floating point estimate of FCLC fines.


float f = String.EstimateFine(text);

Note - We’ve also added a culture specific overload to EstimateFine which enables you to estimate indecency fines in other cultures. Currently this returns 0.0 except when the culture is set to ‘EN-US’.

public static float EstimateFine(string _str, _System.Globalization.CultureInfo culture)

We’ve also changed the behavior of strings so that a string marked with a public accessor (ex: public string s;) that contains indecent content will now raise a System.IndecentException as outlined below:


public class IndecentException : System.Exception

Member of System


The exception that is thrown when the content of a string with a public access modifier is indecent.

Other keywords

We are still debating this, so any feedback is appreciated. Are any of the following language constructs, classes, properties, or methods listed below considered offensive or indecent?

  • unsafe
  • using
  • sizeof
  • EntryPointNotFoundException
  • MakeDirty() (System.Windows.Forms.AxHost)
  • SetDirtyObject (System.Web.UI.StateManagedCollection)
  • IsDirty() (System.Runtime.InteropServices)

Your feedback, as always, is appreciated.


Sun and Microsoft to work together

Go with the flow (layout)