PopupMenuCollection Class
Encapsulates a collection of PopupMenu objects.
public class PopupMenuCollection : IList, ICollection, IEnumerable
- Inheritance:
- Object Object
Remarks
This class is a zero-based indexed collection.
Properties
Count
Gets the number of elements contained in the PopupMenuCollection instance.
public virtual int Count { get; }
Property Value
- Int32:
The number of elements contained in the PopupMenuCollection instance.
InnerList
Gets the list of items contained in the collection instance.
protected ArrayList InnerList { get; }
Property Value
IsFixedSize
Gets a value indicating whether the collection has a fixed size.
public virtual bool IsFixedSize { get; }
Property Value
- Boolean:
true
if the collection has a fixed size; otherwise,false
.
Remarks
A collection with a fixed size does not allow the addition or removal of elements, but it allows the modification of existing elements.
IsReadOnly
Gets a value indicating whether the collection is read-only.
public virtual bool IsReadOnly { get; }
Property Value
- Boolean:
true
if the collection is read-only; otherwise,false
.
IsSynchronized
Gets a value indicating whether access to the collection is synchronized (thread-safe).
public virtual bool IsSynchronized { get; }
Property Value
- Boolean:
true
if the collection is synchronized (thread-safe); otherwise,false
.
Remarks
To guarantee the thread safety of the collection, all operations must be done through the wrapper returned by the SyncRoot property.
Item[Int32]
Gets or sets the PopupMenu at the specified index.
[C#] In C#, this property is the indexer for the PopupMenuCollection
class.
public PopupMenu this[int index] { get; set; }
Parameter | Type | Description |
---|---|---|
index | Int32 | The index of the PopupMenu to return. |
Property Value
Item[String]
Gets the PopupMenu with the specified Key.
[C#] In C#, this property is the indexer for the PopupMenuCollection
class.
SyncRoot
Gets an Object
that can be used to synchronize access to the collection.
public virtual object SyncRoot { get; }
Property Value
- Object:
An
Object
that can be used to synchronize access to the collection.
Methods
Add(PopupMenu)
Adds a PopupMenu to the end of the collection.
public int Add(PopupMenu value)
Parameter | Type | Description |
---|---|---|
value | PopupMenu | The PopupMenu to be added to the end of the collection. |
Returns
Clear()
Removes all PopupMenu objects from the collection.
public void Clear()
Contains(PopupMenu)
Returns whether the specified PopupMenu is in the collection.
public virtual bool Contains(PopupMenu value)
Parameter | Type | Description |
---|---|---|
value | PopupMenu | The PopupMenu to locate in the collection. |
Returns
Contains(String)
public virtual bool Contains(string key)
Parameter | Type | Description |
---|---|---|
key | String |
Returns
- Boolean:
true
if the name is found in the collection; otherwise,false
.
CopyTo(Array, Int32)
Copies the entire collection to a compatible one-dimensional Array
,
starting at the specified index of the target array.
public virtual void CopyTo(Array array, int arrayIndex)
Parameter | Type | Description |
---|---|---|
array | Array | The one-dimensional |
arrayIndex | Int32 | The zero-based index in |
GetEnumerator()
Retrieves an IEnumerator
object for the entire collection.
public virtual IEnumerator GetEnumerator()
Returns
- IEnumerator:
An
IEnumerator
object for the entire collection
Remarks
Enumerators are intended to be used only to read data in the collection. Enumerators cannot be used to modify the underlying collection.
The enumerator does not have exclusive access to the collection.
When an enumerator is instantiated, it takes a snapshot of the current state of the collection.
If changes are made to the collection, such as adding, modifying or deleting elements, the
snapshot gets out of sync and the enumerator throws an InvalidOperationException
.
Two enumerators instantiated from the same collection at the same time can have
different snapshots of the collection.
IndexOf(PopupMenu)
Searches for the specified PopupMenu and returns the zero-based index of the first occurrence within the entire collection.
public virtual int IndexOf(PopupMenu value)
Parameter | Type | Description |
---|---|---|
value | PopupMenu | The PopupMenu to locate in the collection. |
Returns
IndexOf(String)
Searches for the specified Key of a PopupMenu and returns the zero-based index of the first occurrence within the entire collection.
Insert(Int32, PopupMenu)
Inserts a PopupMenu into the collection at the specified index.
public void Insert(int index, PopupMenu value)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index at which the PopupMenu should be inserted. |
value | PopupMenu | The PopupMenuto insert. |
OnObjectAdded(Int32, PopupMenu)
Performs additional custom processes after an object is added to the collection.
protected virtual void OnObjectAdded(int index, PopupMenu value)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index at which the object was inserted. |
value | PopupMenu | The object that was inserted. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is added.
OnObjectAdding(Int32, PopupMenu)
Performs additional custom processes before an object is added to the collection.
protected virtual void OnObjectAdding(int index, PopupMenu value)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index at which the object was inserted. |
value | PopupMenu | The object that was inserted. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is added.
OnObjectRemoved(Int32, PopupMenu)
Performs additional custom processes after an object is removed from the collection.
protected virtual void OnObjectRemoved(int index, PopupMenu value)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index from which the object was removed. |
value | PopupMenu | The object that was removed. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is removed.
OnObjectRemoving(Int32, PopupMenu)
Performs additional custom processes before an object is removed from the collection.
protected virtual void OnObjectRemoving(int index, PopupMenu value)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index from which the object was removed. |
value | PopupMenu | The object that was removed. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified object is removed.
OnValidate(PopupMenu, Int32)
Performs additional custom processes when validating a value.
protected virtual void OnValidate(PopupMenu value, int existingIndex)
Parameter | Type | Description |
---|---|---|
value | PopupMenu | The object to validate. |
existingIndex | Int32 | The index within the collection of the object that would be replaced by the value. |
Remarks
The default implementation of this method determines whether value is null, and if so, throws ArgumentNullException. It is intended to be overridden by a derived class to perform additional action when the specified element is validated.
Remove(PopupMenu)
Removes the first occurrence of a specific PopupMenu from the collection.
public void Remove(PopupMenu value)
Parameter | Type | Description |
---|---|---|
value | PopupMenu | The PopupMenu to remove from the collection. |
Remarks
The elements that follow the removed element move up to occupy the vacated spot. The indexes of the elements that are moved are also updated.
RemoveAt(Int32)
Removes the PopupMenu at the specified index of the collection.
public void RemoveAt(int index)
Parameter | Type | Description |
---|---|---|
index | Int32 | The zero-based index of the PopupMenu to remove. |
Remarks
The elements that follow the removed element move up to occupy the vacated spot. The indexes of the elements that are moved are also updated.
Inherited Members
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()