我有一个包含构造函数和函数的类,这只是一个例子
public class CheckValue
{
private readonly ConcurrentDictionary<string, ValuesForTest> _values;
public CheckValue()
{
_values = JsonConvert
.DeserializeObject<ConcurrentDictionary<string, ValuesForTest>>(HttpContext.Current.Session["valueInSession"]);
}
}
我需要在 CheckValue 类的所有函数中使用值 我的问题是我不知道我的代码是否干净,我使用了 oop 的最佳实践
我建议传递您想要在构造函数类中使用的值