6 responses to “Spontaneously Obsolete”

  1. Fabian De Rango

    Is it true that you can have both VS 03 and 05 installed and running on the same windows?

  2. Fabian De Rango

    Thanks what is the plugin which you use which send the commentor an email on reply?

  3. Peter Ritchie

    Actually, static readonly array fields are a pretty serious design flaw. For example, try Path.InvalidPathChars[ @0@ ] = '\\'. After that call, all further uses of Path.InvalidPathChars now get modified data. This is because the reference is readonly, but not the contents. The new GetInvalidPathChars() method returns a clone of the array, so you can’t modify the data intialized in the static constructor. “out of the box” they both return the exact same data.

  4. Mike Goatly

    Hi Jaykul,

    You’re right about having the clone code in the property, but there is a fairly subtle issue around doing that: unaware users can use for (i = 0; i < Path.InvalidPathChars.Length; i++) which would cause the array to be cloned each time the code loops. Developers are much less likely to use < Path.GetInvalidPathChars().Length because it “feels wrong” to use a method in this way. Properties generally should be very light weight – cloning arrays doesn’t really fall under that category.