System.Web 2.0.0.0 System.Object System.Collections.ICollection System.Web.UI.IStateManager

The class is used to store and manage a collection of objects in the control. The control uses the class to store its root menu items in the property. This collection is also used for the property of a object to store a menu item's submenu items (if any).

The class supports several ways to access the items in the collection:

Use the indexer to directly retrieve a object at a specific zero-based index.

Use the method to create an enumerator that can be used to iterate through the collection.

Use the method to copy the contents of the collection into an array.

You can programmatically manage a object by adding and removing objects. To add menu items to the collection, use the or the method. To remove nodes from the collection, use the , the , or the method.

When the control is bound to a data source, the and collections are automatically populated each time binding occurs. Any changes to the collections between bindings will be lost. To retain these changes, either update the data source or manually rebuild the collection each time you bind.

The class contains properties and methods that allow you to retrieve information about the collection itself. To find out how many items are in the collection, use the property. If you want to determine whether the collection contains a certain object, use the method. To get the index of a object in the collection, use the method.

Represents a collection of menu items in a control. This class cannot be inherited.

- Constructor

  Use this constructor to initialize a new instance of the class using the default values. This constructor is commonly used when creating a collection of root menu items where a parent menu (or owner) is not required.

  When creating a collection of child menu items, you should use the overloaded constructor that takes the parameter, instead of this constructor, to specify the parent menu item.

  This constructor is used primarily by control developers when extending the control to initialize the property.

  Initializes a new instance of the class using the default values.

  2.0.0.0
- Constructor

  Use this constructor to initialize a new instance of the class using the specified parent menu item (or owner). This constructor is commonly used when creating a collection of child menu items where you need to specify the parent menu item.

  When creating a collection of root menu items, consider using the default constructor because root menu items do not have a parent menu item.

  This constructor is used primarily by control developers when extending the class to initialize the property.

  Initializes a new instance of the class using the specified parent menu item (or owner).

  A that represents the parent menu item of the current .
  2.0.0.0
- Method
  System.Void ``

  Use the method to append the specified object to the end of the collection.

  You can add null values and duplicate objects to the collection.

  As an alternative, you can insert a object in the collection at a specific index by using the method.

  Appends the specified object to the end of the current object.

  The to append to the end of the current . 2.0.0.0
- Method
  System.Void `` ``

  Use the method to insert the specified object in the collection at the specified index.

  You can add null values and duplicate objects to the collection.

  As an alternative, you can simply append a object to the end of the collection by using the method.

  Inserts the specified object in the current object at the specified index location.

  The zero-based index location at which to insert the . The to insert. 2.0.0.0
- Method
  System.Void

  Use the method to remove every object from the current object.

  To remove an individual node from the collection, consider using the or the method.

  Removes all items from the current object.

  2.0.0.0
- Method
  System.Boolean `` To be added.

  Use the method to determine whether a object is contained in the current object. The and its properties is compared with the passed in value. This method is commonly used to test for the existence of a object before performing a task, such as adding or removing a menu item from the collection.

  Determines whether the specified object is in the collection.

  true if the specified object is contained in the collection; otherwise, false.

  2.0.0.0
- Method
  System.Void `` `` To be added.

  Use the method to copy the contents of the current object into the specified zero-based . Items are copied starting at the specified index of the target array. With the , you can then use array syntax to access the items in the object.

  As an alternative, you can also use the method to create an enumerator that can be used to access the items in the collection.

  Copies all the items from the object to a compatible one-dimensional , starting at the specified index in the target array.

  The position in the target array at which to start receiving the copied content. 2.0.0.0
- Method
  System.Void `` `` To be added.

  Use the method to copy the contents of the current object into the specified zero-based array. Items are copied starting at the specified index of the target array. With the array, you can then use array syntax to access the items in the object.

  As an alternative, you can also use the method to create an enumerator that can be used to access the items in the collection.

  Copies all the items from the object to a compatible one-dimensional array of objects, starting at the specified index in the target array.

  The position in the target array at which to start receiving the copied content. 2.0.0.0
- Property
  System.Int32 To be added.

  Use the property to determine the number of items in a object. This property is commonly used when iterating through a collection to determine the upper bound of the collection. The property is also commonly used to determine whether a collection is empty.

  Gets the number of menu items contained in the current object.

  2.0.0.0
- Method
  System.Collections.IEnumerator

  Use the method to create an enumerator that can be easily iterated through to get each item in the current object. To get the item currently pointed to in the enumerator, use the property. Use the method to move to the next item. If you need to move the enumerator back to the beginning of the collection, use the method.

  After you create an enumerator or use the method, you must call the method. Otherwise, the item represented by the property is undefined.

  As an alternative, you can also use the method to copy the items in the collection to an array. You can then use the array to access the items in the collection.

  Returns an enumerator that can be used to iterate through the items in the current object.

  An enumerator that can be used to iterate through the items in the current .

  2.0.0.0
- Method
  System.Int32 `` To be added.

  Use the method to determine the index of the specified object in the current object. If the menu item is not in the collection, the method returns -1.

  If the specified menu item appears multiple times in the collection, the index of the first occurrence is returned.

  Determines the index of the specified object in the collection.

  The zero-based index of the first occurrence of within the current , if found; otherwise, -1.

  2.0.0.0
- Property
  System.Boolean To be added.

  The property is used to indicate whether access to the object is synchronized (thread safe). This property is derived from the class and is overridden to always return false.

  For more information on the property, see the property of the interface.

  Gets a value indicating whether access to the object is synchronized (thread safe).

  2.0.0.0
- Property
  System.Web.UI.WebControls.MenuItem `` To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Void `` To be added.

  Use the method to remove the specified menu item from the collection. All items that follow that menu item are then moved up to fill in the vacant position. The indexes of the moved items are also updated.

  The object can contain null values, as well as duplicate objects.

  As an alternative, you can remove a menu item from a specific index in the collection by using the method. You can also remove all menu items from the collection by using the method.

  Removes the specified object from the object.

  2.0.0.0
- Method
  System.Void ``

  Use the method to remove the object at the specified index location from the collection. All items that follow that menu item are then moved up to fill in the vacant position. The indexes of the moved items are also updated.

  The object can contain null values, as well as duplicate objects.

  As an alternative, you can remove a specific object by using the method. You can also remove all menu items from the collection by using the method.

  Removes the object at the specified index location from the current object.

  The zero-based index location of the menu item to remove. 2.0.0.0
- Property
  System.Object To be added.

  The property provides a synchronized version of the object that can be used with synchronizing (threading) code.

  The property of this class always returns false, which indicates that the class is not synchronized (not thread safe).

  Synchronizing code must perform operations on the object of the collection, not directly on the object itself. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the object.

  The object returned in this implementation is the object used to store the objects in the collection.

  Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, causing the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

  For more information on the property, see the property of the interface.

  Gets an object that can be used to synchronize access to the object.

  2.0.0.0
- Method
  2.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Property
  2.0.0.0
  System.Boolean To be added. To be added.

  Gets a value that indicates whether the object is saving changes to its view state.

- Method
  2.0.0.0
  System.Void `` To be added.

  Loads the object's previously saved view state.

  An that contains the saved view state values.
- Method
  2.0.0.0
  System.Object To be added.

  Saves the changes to view state to an .

  The that contains the view state changes.

- Method
  2.0.0.0
  System.Void

  After this method has been called on a server control, the property returns true.

  Instructs the object to track changes to its view state.