假设我使用扩展方法创建了一个静态类,如下所示:
public static class MyStaticExtensionClass
{
private static readonly Dictionary<int, SomeClass> AlgoMgmtDict
= new Dictionary<int, SomeClass>();
public static OutputClass ToOutput(this InputClass input)
{
// clears up the dict
// does some kind of transform over the input class
// return an OutputClass object
}
}
在多用户系统中,状态管理字典会无法为变换算法提供正确的值吗?常规类会是更好的设计,还是将 Dictionary 推入方法中是更好的设计?