共用方式為


編譯器錯誤 C2978

語法錯誤: 必須是 'keyword1' 或 'keyword2',但找到的是類型 'keyword3'; 泛型中不支援非類型參數

泛型類別宣告不正確。 如需詳細資訊,請參閱泛型。

範例

下列範例會產生 C2978。

// C2978.cpp
// compile with: /clr /c
generic <ref class T>   // C2978
// try the following line instead
// generic <typename T>   // OK
ref class Utils {
   static void sort(T elems, size_t size);
};

generic <int>
// try the following line instead
// generic <class T>
ref class Utils2 {
   static void sort(T elems, size_t size);
};