dotnet / dotnet/roslynator

Suggestion: Add refactoring for Hashtable

Open
#709 0 comments 0 reactions 0 assignees View on GitHub
Feature Request
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

Suppose we have an old code like this (belongs to .NET 1x):
```C#
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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.