定义字段,我有以下静态类,静态字段:在静态类
public static class IncludeExtender {
private static readonly MethodInfo _include = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo();
}
是否有前面的例子之间有什么区别以下其中一个字段值是在类的构造函数中定义?
public static class IncludeExtender {
private static readonly MethodInfo _include;
static IncludeExtender() {
_include = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo();
}
}
什么是最好的选择呢?
不,这是一样的 – Mangist
同样在某些定义的术语中? – Jay
有关您将使用哪种方法的建议? –