What other improvements in the .NET Dictionary against HashTable besides the [un] box?

Trying to convince someone to switch from .NET 1.1

I have seen people say that one of the benefits of using the Dictionary class in post.NET 1.1 is the increase in productivity due to the fact that it does not have objects for unpacking / casting. Are there any other improvements?

Or any other common benefits for migrating from .NET 1.1?

+4
source share
9 answers

George , I can answer this question in two words:

Type Security.

And now I will expand. Probably the biggest benefit of migrating to .NET 2.0 is the shared and shared collections. A big advantage to IMO than a performance improvement that isn't related to unboxes and value types (which isn't really that important if you don't have huge ArrayLists from ints that you process continuously) doesn't need to be thrown to and from the object. Or, in a nutshell, "type of security." At compile time, you know what the basic type of a collection is, and you cannot deviate from it. With a non-generic collection, you can throw any old thing there, and if you donโ€™t think about the type (which is an even worse performance hit than in boxing), before you start throwing, you can throw an InvalidCastException.

That says why stop at 2.0? .NET 3.0 has WCF and WPF, which are great new ways to communicate and be present .. NET 3.5 has LINQ and lambda expressions that will change how collections are handled.

Tell your friend not to live in the dark ages. This is the time to upgrade!

+16
source

Assuming that you already know the general benefits of using strongly typed collections, null now a valid value. If the old HashTable returned null for the key search, this may mean that the key does not exist, or it may mean that this key is null . You really didnโ€™t know.

Using the dictionary, if you perform a direct search and the key does not exist, an exception is thrown.

In addition, .Net 2.0 collections take advantage of generics to support strongly typed enumerations ( IEnumerable<T> ). The IEnumerable implementation in .NET uses lazy evaluation, and this makes all sorts of fun things easy (and fulfilled!) That were almost impossible to do before. Probably 9 times out of 10 where you pass or return an array or ArrayList through a function, you can use IEnumerable instead.

+3
source

When does .NET 1.1 support end? Is this no longer supported? What are your chances of ever seeing a bug fix?

In addition, the number of people who know at least something about .NET 1.1 is smaller every year. Soon there will be more people who know VB6 than those who know .NET 1.1.

Time has passed for the update. If you still do not need support for Windows 2000 or lower, you donโ€™t have many excuses for not doing this.

+3
source

Other benefits:

GridView, Masterpages, Sitemap, LINQ !!!! (3.5 frames)

There is no reason that any developer (or company) would continue to write new code in VS 2003, or at least I can think.

Now, if this is an old project written in framework 1.1, then this is a completely different matter ...

+2
source

Migrating from VS2003 and .NET 1.1, at least to VS2005 and .NET 2.0, is worth the cost of signing up. Later versions of the .NET Framework after 2.0 seem to be all additive. It is not or not much to break the .NET class libraries. They just added new namespaces and classes. VS2008 and from what I understand, later versions coming down the pipeline will support backward compatibility with .NET 2.0. This makes it easy to upgrade your IDE (I think you need to convert projects to VS2008 project types), and you get the benefits of new IDE improvements when using older versions of the framework. Some of the larger things that I remember that I only like from the VS2008 IDE are the split view when working in ASP.NET, the new CSS windows and javascript intellisense (VS2008 SP1, I believe in this function).

From personal experience, we had some problems with Active Reports. We had to update versions of this to work with the new IDE / framework, and when we switched from VS2008 to VS2005, some of our SSIS package projects did not open correctly because we are still on SQL Server 2005, so be sure to check all the dependencies which you have. on your IDE 2003 with any third-party applications that you can run.

Ralfondo is right, although I would vote for him if I had a representative. Generics are an alternation of the game, and you do not need to create typed collections yourself to have type safety. Seriously .... google search, what should you do in .NET 1.1 and later. The difference is night and day.

+2
source

Strictly typed, Dictionary<,> limited at compile time and therefore safe. Attempting to add invalid values โ€‹โ€‹will result in a compilation error.

+1
source

Using Generics can make your dictionary typical, so when compiling you will find code that might try to add the wrong object. This is better than runtime failure due to unexpected data type. In addition, an enumerator is introduced for the data, which makes it easier to use. Casting the Current property is no longer required.

+1
source

If you restrict the theme to only universal containers, then no. However, .NET 2.0 has introduced a number of improvements in other areas. See http://msdn.microsoft.com/en-us/library/t357fb32.aspx for a more complete list of improvements.

+1
source

This is not exactly a performance issue, but what about the IDE? VS2008 IDE is much better, from stability to functions, to add ... winForm designers are much easier to use.

+1
source

All Articles