menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CollectionEx - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class CollectionEx

    Base class for list collections that fire events before and after changes occur.

    Inheritance
    System.Object
    CollectionEx
    ConnectionPointCollection
    EndPointCollection
    LabelCollection
    LayerCollection
    NodeCollection
    ToolCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    IServiceReferenceHolder
    IServiceReferenceProvider
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Diagram
    Assembly: Syncfusion.Diagram.Base.dll
    Syntax
    public abstract class CollectionEx : IList, ICollection, IEnumerable, ICloneable, ISerializable, IServiceReferenceHolder, IServiceReferenceProvider
    Remarks

    This class provides a base implementation of the IList and IEnumerable interfaces. The internal implementation of the collection is an ArrayList.

    Constructors

    CollectionEx()

    Initializes a new instance of the CollectionEx class.

    Declaration
    public CollectionEx()

    CollectionEx(CollectionEx)

    Initializes a new instance of the CollectionEx class.

    Declaration
    public CollectionEx(CollectionEx src)
    Parameters
    Type Name Description
    CollectionEx src

    The collection.

    CollectionEx(Object)

    Initializes a new instance of the CollectionEx class.

    Declaration
    public CollectionEx(object owner)
    Parameters
    Type Name Description
    System.Object owner

    The collection owner

    CollectionEx(SerializationInfo, StreamingContext)

    Initializes a new instance of the CollectionEx class.

    Declaration
    public CollectionEx(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.SerializationInfo info

    The serialization info.

    System.Runtime.Serialization.StreamingContext context

    The serialization context.

    Properties

    Count

    Gets the number of elements contained in the System.Collections.ICollection.

    Declaration
    public int Count { get; }
    Property Value
    Type
    System.Int32

    EventSink

    Gets the reference event sink.

    Declaration
    protected EventSink EventSink { get; }
    Property Value
    Type Description
    EventSink

    The event sink.

    IsEmpty

    Gets a value indicating whether this instance is empty.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is empty; otherwise, false.

    IsSynchronized

    Gets a value indicating whether access to the System.Collections.ICollection is synchronized (thread safe).

    Declaration
    public bool IsSynchronized { get; }
    Property Value
    Type
    System.Boolean

    Members

    Gets the collection members.

    Declaration
    public ArrayList Members { get; set; }
    Property Value
    Type Description
    System.Collections.ArrayList

    The members.

    Owner

    Gets or sets the collection owner.

    Declaration
    public object Owner { get; set; }
    Property Value
    Type Description
    System.Object

    The owner.

    QuietMode

    Gets or sets a value indicating whether quiet mode for events raising.

    Declaration
    public bool QuietMode { get; set; }
    Property Value
    Type
    System.Boolean

    SyncRoot

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

    Declaration
    public object SyncRoot { get; }
    Property Value
    Type
    System.Object

    UpdateReferences

    Gets or sets a value indicating whether members service references will be updated.

    Declaration
    public bool UpdateReferences { get; set; }
    Property Value
    Type
    System.Boolean

    Methods

    AddRange(ICollection)

    Adds an items to the CollectionEx.

    Declaration
    public void AddRange(ICollection values)
    Parameters
    Type Name Description
    System.Collections.ICollection values

    The System.Collections.ICollection to add to the CollectionEx.

    AddValue(Object)

    Adds an item to the CollectionEx.

    Declaration
    protected int AddValue(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to add to the CollectionEx.

    Returns
    Type Description
    System.Int32

    The position into which the new element was inserted.

    Clear()

    Removes all items from the CollectionEx.

    Declaration
    public void Clear()

    Clone()

    Creates a new object that is a copy of the current instance.

    Declaration
    public abstract object Clone()
    Returns
    Type Description
    System.Object

    A new object that is a copy of this instance.

    CopyTo(Array, Int32)

    Copies the elements of the System.Collections.ICollection to an System.Array, starting at a particular System.Array index.

    Declaration
    public void CopyTo(Array array, int index)
    Parameters
    Type Name Description
    System.Array array

    The one-dimensional System.Array that is the destination of the elements copied from System.Collections.ICollection. The System.Array must have zero-based indexing.

    System.Int32 index

    The zero-based index in array at which copying begins.

    Exceptions
    Type Condition
    System.ArgumentNullException

    array is null.

    System.ArgumentOutOfRangeException

    index is less than zero.

    System.ArgumentException

    array is multidimensional.-or- index is equal to or greater than the length of array.-or- The number of elements in the source System.Collections.ICollection is greater than the available space from index to the end of the destination array.

    System.ArgumentException

    The type of the source System.Collections.ICollection cannot be cast automatically to the type of the destination array.

    GetEnumerator()

    Returns an enumerator that iterates through a collection.

    Declaration
    public abstract IEnumerator GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    An System.Collections.IEnumerator object that can be used to iterate through the collection.

    GetObjectData(SerializationInfo, StreamingContext)

    Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.

    Declaration
    public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.SerializationInfo info

    The System.Runtime.Serialization.SerializationInfo to populate with data.

    System.Runtime.Serialization.StreamingContext context

    The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

    Exceptions
    Type Condition
    System.Security.SecurityException

    The caller does not have the required permission.

    InsertValue(Int32, Object)

    Inserts an item to the CollectionEx at the specified index.

    Declaration
    protected void InsertValue(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index ar which index should be inserted.

    System.Object value

    The System.Object to insert into the CollectionEx.

    OnChangesComplete(CollectionExEventArgs)

    Raises the ChangesComplete event.

    Declaration
    protected virtual void OnChangesComplete(CollectionExEventArgs evtArgs)
    Parameters
    Type Name Description
    CollectionExEventArgs evtArgs

    The CollectionExEventArgs instance containing the event data.

    OnChanging(CollectionExEventArgs)

    Raises the Changing event.

    Declaration
    protected virtual void OnChanging(CollectionExEventArgs evtArgs)
    Parameters
    Type Name Description
    CollectionExEventArgs evtArgs

    The CollectionExEventArgs instance containing the event data.

    OnValidate(ICollection)

    Validates given values.

    Declaration
    protected abstract void OnValidate(ICollection values)
    Parameters
    Type Name Description
    System.Collections.ICollection values

    The values to validate.

    Exceptions
    Type Condition
    System.InvalidCastException

    OnValidate(Object)

    Validates given value.

    Declaration
    protected abstract void OnValidate(object value)
    Parameters
    Type Name Description
    System.Object value

    value to validate

    Exceptions
    Type Condition
    System.InvalidCastException

    ProvideServiceReference(RuntimeTypeHandle)

    Provides the service reference for object that use that instance.

    Declaration
    public object ProvideServiceReference(RuntimeTypeHandle typeHandle)
    Parameters
    Type Name Description
    System.RuntimeTypeHandle typeHandle

    The type handle.

    Returns
    Type Description
    System.Object

    The object.

    RaiseChangesCompleteEvent(CollectionExEventArgs)

    Raises ChangesComplete event.

    Declaration
    protected virtual void RaiseChangesCompleteEvent(CollectionExEventArgs evtArgs)
    Parameters
    Type Name Description
    CollectionExEventArgs evtArgs

    event args

    RaiseChangingEvent(CollectionExEventArgs)

    Raise Changing event.

    Declaration
    protected virtual void RaiseChangingEvent(CollectionExEventArgs evtArgs)
    Parameters
    Type Name Description
    CollectionExEventArgs evtArgs

    event args

    RemoveAt(Int32)

    Removes the CollectionEx item at the specified index.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index of the item to remove.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is not a valid index in the CollectionEx.

    RemoveRange(ICollection)

    Removes the values occurrence of a specific object from the CollectionEx.

    Declaration
    protected void RemoveRange(ICollection values)
    Parameters
    Type Name Description
    System.Collections.ICollection values

    The System.Collections.ICollection to remove from the CollectionEx.

    RemoveValue(Object)

    Removes the first occurrence of a specific object from the CollectionEx.

    Declaration
    protected bool RemoveValue(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to remove from the CollectionEx.

    Returns
    Type Description
    System.Boolean

    true, if remove value otherwise, false.

    Set(Int32, Object)

    Assigns new value to member in specified position .

    Declaration
    protected void Set(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index

    The index of element.

    System.Object value

    The new value to set.

    Sort(IComparer)

    Sort list using the specified comparer.

    Declaration
    public void Sort(IComparer comparer)
    Parameters
    Type Name Description
    System.Collections.IComparer comparer

    The comparer to sort items.

    UpdateServiceReferences(CollectionExEventArgs)

    Updates the service references the collection members.

    Declaration
    protected virtual void UpdateServiceReferences(CollectionExEventArgs evtArgs)
    Parameters
    Type Name Description
    CollectionExEventArgs evtArgs

    The CollectionExEventArgs instance containing the event data.

    UpdateServiceReferences(IServiceReferenceProvider)

    Updates the service references using service provider.

    Declaration
    public void UpdateServiceReferences(IServiceReferenceProvider provider)
    Parameters
    Type Name Description
    IServiceReferenceProvider provider

    The service provider.

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Returns an enumerator that iterates through a collection.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    An System.Collections.IEnumerator object that can be used to iterate through the collection.

    IList.Add(Object)

    Adds an item to the System.Collections.IList.

    Declaration
    int IList.Add(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to add to the System.Collections.IList.

    Returns
    Type Description
    System.Int32

    The position into which the new element was inserted.

    Exceptions
    Type Condition
    System.NotSupportedException

    The System.Collections.IList is read-only.-or- The System.Collections.IList has a fixed size.

    IList.Clear()

    Removes all items from the System.Collections.IList.

    Declaration
    void IList.Clear()
    Exceptions
    Type Condition
    System.NotSupportedException

    The System.Collections.IList is read-only.

    IList.Contains(Object)

    Determines whether the System.Collections.IList contains a specific value.

    Declaration
    bool IList.Contains(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to locate in the System.Collections.IList.

    Returns
    Type Description
    System.Boolean

    true if the System.Object is found in the System.Collections.IList; otherwise, false.

    IList.get_Item(Int32)

    Declaration
    object IList.get_Item(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type
    System.Object

    IList.IndexOf(Object)

    Determines the index of a specific item in the System.Collections.IList.

    Declaration
    int IList.IndexOf(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to locate in the System.Collections.IList.

    Returns
    Type Description
    System.Int32

    The index of value if found in the list; otherwise, -1.

    IList.Insert(Int32, Object)

    Inserts an item to the System.Collections.IList at the specified index.

    Declaration
    void IList.Insert(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index at which value should be inserted.

    System.Object value

    The System.Object to insert into the System.Collections.IList.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is not a valid index in the System.Collections.IList.

    System.NotSupportedException

    The System.Collections.IList is read-only.-or- The System.Collections.IList has a fixed size.

    System.NullReferenceException

    value is null reference in the System.Collections.IList.

    IList.IsFixedSize

    Gets a value indicating whether the System.Collections.IList has a fixed size.

    Declaration
    bool IList.IsFixedSize { get; }
    Returns
    Type
    System.Boolean

    IList.IsReadOnly

    Gets a value indicating whether the System.Collections.IList is read-only.

    Declaration
    bool IList.IsReadOnly { get; }
    Returns
    Type
    System.Boolean

    IList.Item[Int32]

    Gets or sets the System.Object at the specified index.

    Declaration
    object IList.this[] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    Returns
    Type Description
    System.Object

    The object in list.

    IList.Remove(Object)

    Removes the first occurrence of a specific object from the System.Collections.IList.

    Declaration
    void IList.Remove(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to remove from the System.Collections.IList.

    Exceptions
    Type Condition
    System.NotSupportedException

    The System.Collections.IList is read-only.-or- The System.Collections.IList has a fixed size.

    IList.RemoveAt(Int32)

    Removes the System.Collections.IList item at the specified index.

    Declaration
    void IList.RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index of the item to remove.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is not a valid index in the System.Collections.IList.

    System.NotSupportedException

    The System.Collections.IList is read-only.-or- The System.Collections.IList has a fixed size.

    IList.set_Item(Int32, Object)

    Declaration
    void IList.set_Item(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index
    System.Object value

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    IServiceReferenceHolder
    IServiceReferenceProvider

    Extension Methods

    EnumerableExtensions.GetElementType(IEnumerable)
    EnumerableExtensions.GetItemPropertyInfo(IEnumerable)
    FunctionalExtensions.ForEach<T>(IEnumerable, Action<T>)
    FunctionalExtensions.ToList<T>(IEnumerable)
    FunctionalExtensions.MoveTo(IList, Int32, Int32)
    QueryableExtensions.OfQueryable(IEnumerable)
    QueryableExtensions.OfQueryable(IEnumerable, Type)
    QueryableExtensions.GroupByMany<TElement>(IEnumerable, Type, List<Func<TElement, Object>>)
    QueryableExtensions.GroupByMany(IEnumerable, Type, Func<String, Expression>, String[])
    QueryableExtensions.GroupByMany(IEnumerable, Type, List<SortDescriptor>, Dictionary<String, IComparer<Object>>, Func<String, Expression>, String[])
    QueryableExtensions.GroupByMany(IEnumerable, Type, List<SortDescriptor>, Func<String, Expression>, String[])
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved