roslynator
roslynator copied to clipboard
Suggestion: Add refactoring for Hashtable
trafficstars
Suppose we have an old code like this (belongs to .NET 1x):
namespace SimpleParser
{
public class IanaEncodings
{
private static readonly Hashtable _map = new Hashtable();
static IanaEncodings()
{
_map["CP037"] = 37;
_map["CSIBM037"] = 37;
}
}
}
It would be really useful to have a refactoring for converting the Hashtable to a Dictionary to avoid the future boxings. The structure of this Dictionary should be detected from the usage of the _map here: Dictionary<string, int>