我在工作中看到过这样的代码:
class FooPlugin : IPlugin // IPlugin is a Microsoft CRM component, it has something special about it's execution
{
static FooPlugin()
{
SomeObject.StaticFunction(); // The guy who wrote it said it's meaningful to this question but he can't remember why.
}
}
你知道构造函数上的静态修饰符是什么意思吗?为什么在这种情况下需要它?