What C # features will be removed if backward compatibility was not a problem?

Backward compatibility is a big problem for language developers, especially when a language is as popular as C #. Over time, languages ​​accumulate obsolete features. He believed that these functions should be avoided, but they are stored in the language for compatibility with older versions.

What language features or base class libraries in C # should be removed if backward compatibility was not a problem?

I am not asking about features that some developers like and others hate. I'm interested in functions that are (by and large) universal, considered the best possible (possibly because there is now a better way to do the same).

+6
c #
source share
10 answers

ArrayList .

It makes no sense to use it anymore. List <> is better.

+16
source share

I heard some of the C # designers mention that they regret creating covariant arrays.

+13
source share

I know this is the obvious answer, but any class, property or method marked with the [Obsolete] attribute is likely to be the first to be deleted.

+4
source share

Non-printable types by default.

+2
source share

When implementing IEnumerable<T> you will have to implement IEnumerator<T> GetEnumerator() as well as System.Collections.IEnumerator GetEnumerator() for backward compatibility reasons.

+2
source share

The ReaderWriterLock class is basically meaningless in favor of the ReaderWriterLockSlim class, which Microsoft itself says for all new developments .

+1
source share

Named parameters of the attribute constructor.

You are currently setting named parameters:

 [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] 

This is time from C # 1, but now there are object constructors:

 new Foo(explicit, values) { Implicit = value } 

This will result in the following attribute constructor:

 [AttributeUsage(AttributeTargets.Method) { Inherited = false, AllowMultiple = true }] 
+1
source share

Field System.IO.Path.InvalidPathChars . Using this leads to a security risk, but they cannot do anything for compatibility reasons.

0
source share

From BCL:

  • COM Interop
  • StringCollection (general list)
  • StringDictionary (general dictionary)
-2
source share

General lists (as indicated by Reshure), including "var". I advocate explicitly declaring variables.

Edit: I think people equate “generic lists” with “generics”. If you prefer "untyped collections" such as Hashtable or ArrayList.

-eighteen
source share

All Articles