CompilerErrorCollection.AddRange 方法

定义

将数组的元素复制到错误集合的末尾。

重载

名称 说明
AddRange(CompilerError[])

将数组的元素复制到错误集合的末尾。

AddRange(CompilerErrorCollection)

将指定的编译器错误集合的内容添加到错误集合的末尾。

AddRange(CompilerError[])

Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs

将数组的元素复制到错误集合的末尾。

public:
 void AddRange(cli::array <System::CodeDom::Compiler::CompilerError ^> ^ value);
public void AddRange(System.CodeDom.Compiler.CompilerError[] value);
member this.AddRange : System.CodeDom.Compiler.CompilerError[] -> unit
Public Sub AddRange (value As CompilerError())

参数

value
CompilerError[]

包含要添加到集合中的对象的类型的 CompilerError 数组。

例外

valuenull

示例

下面的示例演示如何使用AddRange(CompilerError[])方法重载向 aCompilerError.CompilerErrorCollection

// Adds an array of CompilerError objects to the collection.
CompilerError[] errors = { new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") };
collection.AddRange( errors );

// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection errorsCollection = new CompilerErrorCollection();
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
collection.AddRange( errorsCollection );
' Adds an array of CompilerError objects to the collection.
Dim errors As CompilerError() = {New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")}
collection.AddRange(errors)

' Adds a collection of CompilerError objects to the collection.
Dim errorsCollection As New CompilerErrorCollection()
errorsCollection.Add(New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"))
errorsCollection.Add(New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"))
collection.AddRange(errorsCollection)

另请参阅

适用于

AddRange(CompilerErrorCollection)

Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs
Source:
CompilerErrorCollection.cs

将指定的编译器错误集合的内容添加到错误集合的末尾。

public:
 void AddRange(System::CodeDom::Compiler::CompilerErrorCollection ^ value);
public void AddRange(System.CodeDom.Compiler.CompilerErrorCollection value);
member this.AddRange : System.CodeDom.Compiler.CompilerErrorCollection -> unit
Public Sub AddRange (value As CompilerErrorCollection)

参数

value
CompilerErrorCollection

包含 CompilerErrorCollection 要添加到集合的对象的对象。

例外

valuenull

示例

下面的示例演示如何使用AddRange(CompilerErrorCollection)方法重载将对象从一个对象添加到CompilerError另一个CompilerErrorCollectionCompilerErrorCollection对象。

// Adds an array of CompilerError objects to the collection.
CompilerError[] errors = { new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") };
collection.AddRange( errors );

// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection errorsCollection = new CompilerErrorCollection();
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
collection.AddRange( errorsCollection );
' Adds an array of CompilerError objects to the collection.
Dim errors As CompilerError() = {New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")}
collection.AddRange(errors)

' Adds a collection of CompilerError objects to the collection.
Dim errorsCollection As New CompilerErrorCollection()
errorsCollection.Add(New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"))
errorsCollection.Add(New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"))
collection.AddRange(errorsCollection)

另请参阅

适用于