AttributeCollection(StateBag) 构造函数
定义
初始化 AttributeCollection 类的新实例。Initializes a new instance of the AttributeCollection class.
public:
AttributeCollection(System::Web::UI::StateBag ^ bag);
public AttributeCollection (System.Web.UI.StateBag bag);
new System.Web.UI.AttributeCollection : System.Web.UI.StateBag -> System.Web.UI.AttributeCollection
Public Sub New (bag As StateBag)
参数
- bag
- StateBag
一个对象,包含服务器控件的开始标记的特性键以及它们的值。An object that contains the attribute keys and their values from the opening tag of the server control.
示例
下面的示例演示如何使用 AttributeCollection 构造函数创建名为的类的实例 myAttributeCollection 。The following example shows how to use the AttributeCollection constructor to create an instance of the class named it myAttributeCollection. 该代码将控件的 ViewState 属性作为参数参数进行传递。The code passes the control's ViewState property as a parameter argument.
myAttributeCollection = new AttributeCollection(ViewState);
myAttributeCollection = New AttributeCollection(ViewState)