ExpressionBuilderCollection.Add(ExpressionBuilder) 方法
定义
将 ExpressionBuilder 对象添加到 ExpressionBuilderCollection。Adds an ExpressionBuilder object to the ExpressionBuilderCollection.
public:
void Add(System::Web::Configuration::ExpressionBuilder ^ buildProvider);
public void Add (System.Web.Configuration.ExpressionBuilder buildProvider);
member this.Add : System.Web.Configuration.ExpressionBuilder -> unit
Public Sub Add (buildProvider As ExpressionBuilder)
参数
- buildProvider
- ExpressionBuilder
指定 ExpressionBuilder 引用的字符串值。A string value specifying the ExpressionBuilder reference.
例外
集合中已经存在要添加的 ExpressionBuilder 对象或该集合为只读。The ExpressionBuilder object to add already exists in the collection, or the collection is read-only.
示例
下面的代码示例演示如何使用 Add 方法。The following code example demonstrates how to use the Add method. 此代码示例是为类提供的更大示例的一部分 ExpressionBuilderCollection 。This code example is part of a larger example provided for the ExpressionBuilderCollection class.
// Create a new ExpressionBuilder reference.
ExpressionBuilder myExpressionBuilder =
new ExpressionBuilder("myCustomExpression", "MyCustomExpressionBuilder");
// Add an ExpressionBuilder to the configuration.
configSection.ExpressionBuilders.Add(myExpressionBuilder);
' Create a new ExpressionBuilder reference.
Dim myExpressionBuilder As ExpressionBuilder = _
New ExpressionBuilder("myCustomExpression", "MyCustomExpressionBuilder")
' Add an ExpressionBuilder to the configuration.
configSection.ExpressionBuilders.Add(myExpressionBuilder)
注解
将 ExpressionBuilder 对象添加到集合。Adds an ExpressionBuilder object to the collection. 如果程序集对象未使用程序集信息初始化,则将引发异常。If the assembly object is not initialized with assembly information, an exception is thrown. 如果集合中已存在程序集对象,则忽略该语句。If the assembly object already exists in the collection, the statement is ignored.