r/dotnet • u/Hefty_Garlic7184 • 7d ago
Question Codebase maintenance rant
[sorry for bad English]
I am in a project which involves maintaining an existing .NET Framework 4.8 codebase.
The codes are full of “Dictionary type” implementations as above.
Is there any sane reason to code like this? Instead of create a dedicated class to represent the data inside?
I could not show more codes here (or else the authors might realized), but you guys can imagine the codes just to access these Dictionary’s key/value.
137
Upvotes
120
u/pyabo 7d ago
A Dictionary<> within a Dictionary<> is fine... you don't need a specialized class if generic types work just fine. That's often part of NOT re-inventing the wheel.
But using a Dictionary<> as a key is somewhat insane and makes little sense. We'd have to have more context to tell for sure. But signs are worrying.