CodeDirectiveCollection.AddRange 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
向集合添加一组 CodeDirective 对象。
重载
AddRange(CodeDirective[]) |
将 CodeDirective 对象的数组添加到集合的末尾。 |
AddRange(CodeDirectiveCollection) |
将指定 CodeDirectiveCollection 对象的内容添加到集合的末尾。 |
AddRange(CodeDirective[])
- Source:
- CodeDirectiveCollection.cs
- Source:
- CodeDirectiveCollection.cs
- Source:
- CodeDirectiveCollection.cs
将 CodeDirective 对象的数组添加到集合的末尾。
public:
void AddRange(cli::array <System::CodeDom::CodeDirective ^> ^ value);
public void AddRange (System.CodeDom.CodeDirective[] value);
member this.AddRange : System.CodeDom.CodeDirective[] -> unit
Public Sub AddRange (value As CodeDirective())
参数
- value
- CodeDirective[]
要添加到集合中的 CodeDirective 对象的数组。
例外
value
为 null
。
示例
下面的代码示例演示如何使用 AddRange(CodeDirective[]) 方法将 对象的数组 CodeDirective 添加到集合中。 此示例是为 类提供的更大示例的一 CodeDirectiveCollection 部分。
// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);
// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);
' Adds an array of CodeDirective objects to the collection.
Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
collection.AddRange(directives)
' Adds a collection of CodeDirective objects to the collection.
Dim directivesCollection As New CodeDirectiveCollection()
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
collection.AddRange(directivesCollection)
另请参阅
适用于
AddRange(CodeDirectiveCollection)
- Source:
- CodeDirectiveCollection.cs
- Source:
- CodeDirectiveCollection.cs
- Source:
- CodeDirectiveCollection.cs
将指定 CodeDirectiveCollection 对象的内容添加到集合的末尾。
public:
void AddRange(System::CodeDom::CodeDirectiveCollection ^ value);
public void AddRange (System.CodeDom.CodeDirectiveCollection value);
member this.AddRange : System.CodeDom.CodeDirectiveCollection -> unit
Public Sub AddRange (value As CodeDirectiveCollection)
参数
- value
- CodeDirectiveCollection
一个 CodeDirectiveCollection 对象,它包含要添加到集合中的 CodeDirective 对象。
例外
value
为 null
。
示例
下面的代码示例演示如何使用 AddRange(CodeDirectiveCollection) 方法将 对象的内容 CodeDirectiveCollection 添加到集合中。 此示例是为 类提供的更大示例的一 CodeDirectiveCollection 部分。
// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);
// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);
' Adds an array of CodeDirective objects to the collection.
Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
collection.AddRange(directives)
' Adds a collection of CodeDirective objects to the collection.
Dim directivesCollection As New CodeDirectiveCollection()
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
collection.AddRange(directivesCollection)