编译器错误 C2506

'member' : '__declspec(modifier)' 不能应用于此符号

不能为托管类的静态成员声明每个进程或每个 appdomain。

有关更多信息,请参见 appdomain

示例

以下示例生成 C2506。

// C2506.cpp
// compile with: /clr /c
ref struct R {
   __declspec(process) static int n;   // C2506
   int o;   // OK
};