Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion to .Net 3.5

Tags:

c#

.net

I recently started maintaining a .Net 1.1 project and would like to convert it to .Net 3.5.

Any tips to share on reducing code by making use of new features?

As a first attempt, I would like to convert a bunch of static helper functions.

Update: The main reason why I am converting is to learn new features like static classes, LINQ etc. Just for my own use at least for now.

like image 635
Chris S Avatar asked Mar 01 '23 20:03

Chris S


2 Answers

I would suggest starting by migrating to .NET 2.0 features, first.

My first step would be to slowly refactor to move all the collections to generic collections. This will help tremendously, and ease the migration into the .NET 3.5 features, especially with LINQ. It should also have a nice impact on your performance, since any collections of value types will perform better.

Be wary in this of converting HashTables to Dictionary<T,U>, since the behavior is different in some cases, but otherwise, ArrayList->List<T>, etc are easy, useful conversions.

After that, moving helpers to static classes, and potentially extension methods, would be a good next step to consider. This can make the code more readable.

like image 88
Reed Copsey Avatar answered Mar 12 '23 02:03

Reed Copsey


You can use static classes (C# 2.0 feature) to rewrite old helper functions.

like image 37
Gulzar Nazim Avatar answered Mar 12 '23 02:03

Gulzar Nazim