menu

WinForms

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

    Show / Hide Table of Contents

    Class ArrayListExt

    Extends ArrayList by throwing events when Collection changes, an item's property changes, etc.

    Inheritance
    System.Object
    System.Collections.ArrayList
    ArrayListExt
    IntList
    TypedArrayListExt<T>
    VisuallyInheritableList
    BrushInfoColorArrayList
    TypesToLoadList
    CheckedNodesCollection
    ImageStreamerCollection
    CheckedNodesCollection
    SelectedNodesCollection
    TreeNodeAdvCollection
    SelectedNodesCollection
    TabbedGroupsCollection
    TabGroupItemsList
    TileGroupCollection
    TreeNodeAdvCollection
    Bars
    XPTaskBarItemsCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.ICloneable
    Inherited Members
    System.Collections.ArrayList.Adapter(System.Collections.IList)
    System.Collections.ArrayList.AddRange(System.Collections.ICollection)
    System.Collections.ArrayList.BinarySearch(System.Int32, System.Int32, System.Object, System.Collections.IComparer)
    System.Collections.ArrayList.BinarySearch(System.Object)
    System.Collections.ArrayList.BinarySearch(System.Object, System.Collections.IComparer)
    System.Collections.ArrayList.Capacity
    System.Collections.ArrayList.Clone()
    System.Collections.ArrayList.Contains(System.Object)
    System.Collections.ArrayList.CopyTo(System.Array)
    System.Collections.ArrayList.CopyTo(System.Array, System.Int32)
    System.Collections.ArrayList.CopyTo(System.Int32, System.Array, System.Int32, System.Int32)
    System.Collections.ArrayList.Count
    System.Collections.ArrayList.FixedSize(System.Collections.ArrayList)
    System.Collections.ArrayList.FixedSize(System.Collections.IList)
    System.Collections.ArrayList.GetEnumerator()
    System.Collections.ArrayList.GetEnumerator(System.Int32, System.Int32)
    System.Collections.ArrayList.GetRange(System.Int32, System.Int32)
    System.Collections.ArrayList.IndexOf(System.Object)
    System.Collections.ArrayList.IndexOf(System.Object, System.Int32)
    System.Collections.ArrayList.IndexOf(System.Object, System.Int32, System.Int32)
    System.Collections.ArrayList.IsSynchronized
    System.Collections.ArrayList.LastIndexOf(System.Object)
    System.Collections.ArrayList.LastIndexOf(System.Object, System.Int32)
    System.Collections.ArrayList.LastIndexOf(System.Object, System.Int32, System.Int32)
    System.Collections.ArrayList.ReadOnly(System.Collections.ArrayList)
    System.Collections.ArrayList.ReadOnly(System.Collections.IList)
    System.Collections.ArrayList.Remove(System.Object)
    System.Collections.ArrayList.Repeat(System.Object, System.Int32)
    System.Collections.ArrayList.Reverse()
    System.Collections.ArrayList.SetRange(System.Int32, System.Collections.ICollection)
    System.Collections.ArrayList.Sort()
    System.Collections.ArrayList.Sort(System.Collections.IComparer)
    System.Collections.ArrayList.Synchronized(System.Collections.ArrayList)
    System.Collections.ArrayList.Synchronized(System.Collections.IList)
    System.Collections.ArrayList.SyncRoot
    System.Collections.ArrayList.ToArray()
    System.Collections.ArrayList.ToArray(System.Type)
    System.Collections.ArrayList.TrimToSize()
    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.Collections
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class ArrayListExt : ArrayList, IList, ICollection, IEnumerable, ICloneable
    Remarks

    This class lets you know through the CollectionChanged event when an item gets added or deleted from the ArrayList or when an exisiting item is replaced by a new item at a position. It will also listen for property change notifications from the items in the list, provided the items implement the IChangeNotifyingItem interface and forward them using the ItemPropertyChanged event.

    Constructors

    ArrayListExt()

    Overloaded. Creates a new instance of the ArrayListExt class.

    Declaration
    public ArrayListExt()

    ArrayListExt(Object[])

    Creates a new instance of the ArrayListExt class and inserts the items specified in an array into the ArrayList.

    Declaration
    public ArrayListExt(object[] items)
    Parameters
    Type Name Description
    System.Object[] items

    An array of objects.

    Properties

    ForceFixedSize

    Indicates whether the collection should be made fixed size.

    Declaration
    protected bool ForceFixedSize { get; set; }
    Property Value
    Type Description
    System.Boolean

    True to make the collection fixed size; False otherwise. Default is False.

    Remarks

    When set to True, the IsFixedSize property will return True and no new elements can be added to the list.

    ForceReadOnly

    Indicates whether the collection is Read-only.

    Declaration
    protected bool ForceReadOnly { get; set; }
    Property Value
    Type Description
    System.Boolean

    True to make the collection Read-only; False otherwise. Default is False.

    Remarks

    When set to True, the IsReadOnly property will return True and exisiting items in the list cannot be replaced.

    IsCollectionChangedEventSuspended

    Indicates whether firing CollectionChanged event is suspended.

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

    True indicates firing the event is suspended; False otherwise.

    IsFixedSize

    Declaration
    public override bool IsFixedSize { get; }
    Property Value
    Type
    System.Boolean
    Overrides
    System.Collections.ArrayList.IsFixedSize

    IsReadOnly

    Declaration
    public override bool IsReadOnly { get; }
    Property Value
    Type
    System.Boolean
    Overrides
    System.Collections.ArrayList.IsReadOnly

    Item[Int32]

    Overridden. See System.Collections.ArrayList.Item.

    Declaration
    public override object this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type
    System.Object
    Overrides
    System.Collections.ArrayList.Item[System.Int32]

    Methods

    Add(Object)

    Overridden. See System.Collections.ArrayList.Add.

    Declaration
    public override int Add(object value)
    Parameters
    Type Name Description
    System.Object value
    Returns
    Type
    System.Int32
    Overrides
    System.Collections.ArrayList.Add(System.Object)

    AddHandlers(Object)

    Called when an object gets added to the list.

    Declaration
    protected virtual void AddHandlers(object item)
    Parameters
    Type Name Description
    System.Object item

    The object that got added to the list.

    Remarks

    This provides you a convenient place where you can perform operations pertaining to the addition of an object to the list. Make sure to call the base class when you override this function.

    The method will call the OnCollectionChanged(CollectionChangeEventArgs) method with appropriate parameters.

    Clear()

    Overridden. See System.Collections.ArrayList.Clear().

    Declaration
    public override void Clear()
    Overrides
    System.Collections.ArrayList.Clear()

    Insert(Int32, Object)

    Overridden. See System.Collections.ArrayList.Insert.

    Declaration
    public override void Insert(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index
    System.Object value
    Overrides
    System.Collections.ArrayList.Insert(System.Int32, System.Object)

    InsertRange(Int32, ICollection)

    Overridden. See System.Collections.ArrayList.InsertRange.

    Declaration
    public override void InsertRange(int index, ICollection c)
    Parameters
    Type Name Description
    System.Int32 index
    System.Collections.ICollection c
    Overrides
    System.Collections.ArrayList.InsertRange(System.Int32, System.Collections.ICollection)

    Move(Int32, Int32, Int32)

    Allows you to move one or more items in the collection from one position to another.

    Declaration
    public virtual void Move(int from, int to, int count)
    Parameters
    Type Name Description
    System.Int32 from

    The beginning index of the range of items to move.

    System.Int32 to

    The destination index where the items will be moved to.

    System.Int32 count

    The number of elements in the range to be moved.

    Remarks

    If the above indices are not within the list's count, this method will return without performing any operation.

    For example, say a list contains the following elements: A, B, C, D, E, F. Then the following call:

    list.Move(2, 4, 2); 

    will result in the following array: A, B, E, F, C, D.

    OnCollectionChanged(CollectionChangeEventArgs)

    Raises the CollectionChanged event.

    Declaration
    protected virtual void OnCollectionChanged(CollectionChangeEventArgs args)
    Parameters
    Type Name Description
    System.ComponentModel.CollectionChangeEventArgs args

    A System.ComponentModel.CollectionChangeEventArgs object containing data pertaining to this event.

    Remarks

    The OnCollectionChanged(CollectionChangeEventArgs) method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnCollectionChanged in a derived class, be sure to call the base class's OnCollectionChanged method so that registered delegates receive the event.

    OnCollectionChanging()

    Called when an item is being added, removed, moved or when an exisiting item is replaced by a new item.

    Declaration
    protected virtual void OnCollectionChanging()
    Remarks

    This method does not fire a corresponding event.

    OnItemPropertyChanged(Object, SyncfusionPropertyChangedEventArgs)

    Raises the ItemPropertyChanged event.

    Declaration
    protected virtual void OnItemPropertyChanged(object sender, SyncfusionPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    System.Object sender

    The source of the event.

    SyncfusionPropertyChangedEventArgs e

    The SyncfusionPropertyChangedEventArgs object that contains data pertaining to this event.

    Remarks

    The OnItemPropertyChanged(Object, SyncfusionPropertyChangedEventArgs) method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnItemPropertyChanged(Object, SyncfusionPropertyChangedEventArgs) in a derived class, be sure to call the base class's OnItemPropertyChanged(Object, SyncfusionPropertyChangedEventArgs) method so that registered delegates receive the event.

    RaiseCollectionChanged(CollectionChangeEventArgs)

    Call this method to force a CollectionChanged event.

    Declaration
    public void RaiseCollectionChanged(CollectionChangeEventArgs args)
    Parameters
    Type Name Description
    System.ComponentModel.CollectionChangeEventArgs args

    The args for the above mentioned event.

    Remarks

    This method is useful when after suspending and resuming events in this list, you might want to fire the CollectionChanged event for some specific changes.

    ReleaseHandler(Object)

    Called when an item gets removed from the list.

    Declaration
    protected virtual void ReleaseHandler(object item)
    Parameters
    Type Name Description
    System.Object item

    The object that got removed from the list.

    Remarks

    This provides you a convenient place where you can perform operations pertaining to the removal of an object from the list. Make sure to call the base class when you override this function.

    The base class will call the OnCollectionChanged(CollectionChangeEventArgs) event with appropriate parameters.

    RemoveAt(Int32)

    Overridden. See System.Collections.ArrayList.RemoveAt

    Declaration
    public override void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Overrides
    System.Collections.ArrayList.RemoveAt(System.Int32)

    RemoveRange(Int32, Int32)

    Overridden. See System.Collections.ArrayList.RemoveRange.

    Declaration
    public override void RemoveRange(int index, int count)
    Parameters
    Type Name Description
    System.Int32 index
    System.Int32 count
    Overrides
    System.Collections.ArrayList.RemoveRange(System.Int32, System.Int32)

    ResumeEvents(Boolean)

    Starts throwing the CollectionChanged and ItemPropertyChanged events.

    Declaration
    public void ResumeEvents(bool throwEvent)
    Parameters
    Type Name Description
    System.Boolean throwEvent

    True will throw a CollectionChanged event; False will not.

    Remarks

    Call this method after calling a SuspendEvents() method to resume throwing the CollectionChanged and ItemPropertyChanged events.

    Note that there is no one-to-one correspondence between SuspendEvents and ResumeEvents. SuspendEvents could be called more than once but a single subsequent ResumeEvents call will resume throwing events.

    Reverse(Int32, Int32)

    Reverse range of items in collection from position specified by index parameter and length specified by count parameter.

    Declaration
    public override void Reverse(int index, int count)
    Parameters
    Type Name Description
    System.Int32 index

    range start position.

    System.Int32 count

    range length.

    Overrides
    System.Collections.ArrayList.Reverse(System.Int32, System.Int32)

    Sort(Int32, Int32, IComparer)

    Sorts the elements in the entire System.Collections.ArrayList using the System.IComparable implementation of each element.

    Declaration
    public override void Sort(int index, int count, IComparer comparer)
    Parameters
    Type Name Description
    System.Int32 index
    System.Int32 count
    System.Collections.IComparer comparer
    Overrides
    System.Collections.ArrayList.Sort(System.Int32, System.Int32, System.Collections.IComparer)

    SuspendEvents()

    Will suspend the CollectionChanged and ItemPropertyChanged events temporarily.

    Declaration
    public void SuspendEvents()
    Remarks

    Call ResumeEvents(Boolean) when you are ready to receive events again. The SuspendEvents()/ResumeEvents(Boolean) calls are useful when you are performing a series of operations that will result in multiple changes in the collection, throwing multiple events. In such cases, you could use these methods to have a single event thrown at the end of the series of operations.

    Note that there is no one-to-one correspondence between SuspendEvents() and ResumeEvents(Boolean). SuspendEvents() could be called more than once but a single subsequent ResumeEvents(Boolean) call will resume throwing events.

    Events

    CollectionChanged

    Will be thrown when the Collection has changed due to the addition or removal of one or more items.

    Declaration
    public event CollectionChangeEventHandler CollectionChanged
    Event Type
    Type
    System.ComponentModel.CollectionChangeEventHandler

    ItemPropertyChanged

    Will be thrown if the items in the Collection implement IChangeNotifyingItem interface and when their property changes.

    Declaration
    public event SyncfusionPropertyChangedEventHandler ItemPropertyChanged
    Event Type
    Type
    SyncfusionPropertyChangedEventHandler

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.ICloneable

    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