共用方式為


編譯器錯誤 C3749

'attribute':自訂屬性不可使用於函式內

備註

無法在函式內使用自定義屬性。 如需自定義屬性的詳細資訊,請參閱主題 屬性

範例

下列範例會產生 C3749:

// C3749a.cpp
// compile with: /clr /c
using namespace System;

[AttributeUsage(AttributeTargets::All)]
public ref struct ABC : public Attribute {
   ABC() {}
};

void f1() { [ABC]; };  // C3749