ParserErrorCollection.AddRange 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將物件加入 ParserError 集合。
多載
| 名稱 | Description |
|---|---|
| AddRange(ParserError[]) |
為集合新增一組 ParserError 物件。 |
| AddRange(ParserErrorCollection) |
將現有 ParserErrorCollection 物件加入集合。 |
AddRange(ParserError[])
為集合新增一組 ParserError 物件。
public:
void AddRange(cli::array <System::Web::ParserError ^> ^ value);
public void AddRange(System.Web.ParserError[] value);
member this.AddRange : System.Web.ParserError[] -> unit
Public Sub AddRange (value As ParserError())
參數
- value
- ParserError[]
一個型別 ParserError 的陣列,指定要加入集合的值。
例外狀況
value 是 null。
範例
以下程式碼範例示範如何將物件ParserError範圍加入物件。ParserErrorCollection
// Add an array of ParserError objects to the collection.
ParserError[] errors =
{ new ParserError("Error 2", "Path", 1),
new ParserError("Error 3", "Path", 1) };
collection.AddRange(errors);
// Add a collection of ParserError objects to the collection.
ParserErrorCollection errorsCollection = new ParserErrorCollection();
errorsCollection.Add(new ParserError("Error", "Path", 1));
errorsCollection.Add(new ParserError("Error", "Path", 1));
collection.AddRange(errorsCollection);
' Add an array of ParserError objects to the collection.
Dim errors As ParserError() = _
{New ParserError("Error 2", "Path", 1), _
New ParserError("Error 3", "Path", 1)}
collection.AddRange(errors)
' Ads a collection of ParserError objects to the collection.
Dim errorsCollection As New ParserErrorCollection()
errorsCollection.Add(New ParserError("Error", "Path", 1))
errorsCollection.Add(New ParserError("Error", "Path", 1))
collection.AddRange(errorsCollection)
備註
使用該 AddRange 方法將物件陣列 ParserError 加入集合。 當你建立多個AddRange物件並想用單一方法呼叫將它們加入集合時,這個ParserError方法非常有用。 若要將個別 ParserError 物件加入集合,請使用該 Add 方法。
適用於
AddRange(ParserErrorCollection)
將現有 ParserErrorCollection 物件加入集合。
public:
void AddRange(System::Web::ParserErrorCollection ^ value);
public void AddRange(System.Web.ParserErrorCollection value);
member this.AddRange : System.Web.ParserErrorCollection -> unit
Public Sub AddRange (value As ParserErrorCollection)
參數
- value
- ParserErrorCollection
A ParserErrorCollection 包含 ParserError 要加入集合的物件。
例外狀況
ParserError 值是 null。
範例
以下程式碼範例示範如何將物件ParserError範圍加入物件。ParserErrorCollection
// Add an array of ParserError objects to the collection.
ParserError[] errors =
{ new ParserError("Error 2", "Path", 1),
new ParserError("Error 3", "Path", 1) };
collection.AddRange(errors);
// Add a collection of ParserError objects to the collection.
ParserErrorCollection errorsCollection = new ParserErrorCollection();
errorsCollection.Add(new ParserError("Error", "Path", 1));
errorsCollection.Add(new ParserError("Error", "Path", 1));
collection.AddRange(errorsCollection);
' Add an array of ParserError objects to the collection.
Dim errors As ParserError() = _
{New ParserError("Error 2", "Path", 1), _
New ParserError("Error 3", "Path", 1)}
collection.AddRange(errors)
' Ads a collection of ParserError objects to the collection.
Dim errorsCollection As New ParserErrorCollection()
errorsCollection.Add(New ParserError("Error", "Path", 1))
errorsCollection.Add(New ParserError("Error", "Path", 1))
collection.AddRange(errorsCollection)
備註
與該 Add 方法不同,該 AddRange 方法沒有回傳值可用來判斷被加入物件是否 ParserError 已在集合中。 如果你需要這些資訊,請先用該 Contains 方法再使用 AddRange。