Share via


CompilerErrorCollection.Add(CompilerError) 方法

定義

將指定的 CompilerError 物件加入至錯誤集合中。

public:
 int Add(System::CodeDom::Compiler::CompilerError ^ value);
public int Add (System.CodeDom.Compiler.CompilerError value);
member this.Add : System.CodeDom.Compiler.CompilerError -> int
Public Function Add (value As CompilerError) As Integer

參數

value
CompilerError

要加入的 CompilerError 物件。

傳回

要插入新項目的索引。

範例

下列範例示範如何使用 Add 方法將 物件新增 CompilerErrorCompilerErrorCollection

// Adds a CompilerError to the collection.
collection->Add( gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" ) );
// Adds a CompilerError to the collection.
collection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
' Adds a CompilerError to the collection.
collection.Add(New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"))

適用於

另請參閱