Click or drag to resize

CommandifiedList<T> Class

Generic list class which is command-aware: it performs its actions through commands, so all actions on this list are undoable.
Inheritance Hierarchy
System.Object
  System.Collections.ObjectModel.Collection<T>
    SD.Tools.Algorithmia.GeneralDataStructures.CommandifiedList<T>
      More...

Namespace:  SD.Tools.Algorithmia.GeneralDataStructures
Assembly:  SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.3.3.0 (1.3.18.0209)
Syntax
public class CommandifiedList<T> : Collection<T>, 
	IBindingList, IList, ICollection, IEnumerable

Type Parameters

T
The type of the element inside the list.

The CommandifiedList<T> type exposes the following members.

Constructors
  NameDescription
Public methodCommandifiedList<T>()
Initializes a new instance of the CommandifiedList<T> class. This instance is not synchronized.
Public methodCommandifiedList<T>(Boolean)
Initializes a new instance of the CommandifiedList<T> class.
Top
Properties
  NameDescription
Public propertyAllowEdit
Gets whether you can update items in the list.
Public propertyAllowNew
Public propertyAllowRemove
Gets whether you can remove items from the list, using Remove(Object) or RemoveAt(Int32).
Public propertyCount (Inherited from Collection<T>.)
Public propertyIsSorted
Gets whether the items in the list are sorted.
Public propertyIsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe). Default: false. Set to true in the ctor to make sure the operations on this object are using locks. Use SyncRoot to lock on the same object as this class' internal operations.
Public propertyItem
Gets or sets the instance at the specified index. This is a redefinition, so the get can be synchronized if needed.
Protected propertyItems (Inherited from Collection<T>.)
Public propertySortDirection
Gets the direction of the sort.
Public propertySortProperty
Gets the PropertyDescriptor that is being used for sorting.
Public propertySupportsChangeNotification
Gets whether a ListChanged event is raised when the list changes or an item in the list changes.
Public propertySupportsSearching
Gets whether the list supports searching using the Find(PropertyDescriptor, Object) method.
Public propertySupportsSorting
Gets whether the list supports sorting.
Public propertySuppressEvents
Gets or sets a value indicating whether events are blocked from being raised (true) or not (false, default)
Public propertySyncRoot
Gets an object that can be used to synchronize access to the ICollection. It's the same object used in locks inside this object.
Top
Methods
  NameDescription
Public methodAdd (Inherited from Collection<T>.)
Public methodAddIndex
Adds the PropertyDescriptor to the indexes used for searching.
Public methodAddNew
Adds a new item to the list.
Public methodAddRange
Adds the elements in the range specified to this list in one command
Public methodApplySort
Sorts the list based on a PropertyDescriptor and a ListSortDirection.
Public methodClear (Inherited from Collection<T>.)
Protected methodClearItems (Overrides Collection<T>.ClearItems().)
Public methodContains (Inherited from Collection<T>.)
Public methodCopyTo (Inherited from Collection<T>.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind
Returns the index of the row that has the given PropertyDescriptor.
Public methodGetEnumerator (Inherited from Collection<T>.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf (Inherited from Collection<T>.)
Public methodInsert (Inherited from Collection<T>.)
Protected methodInsertItem (Overrides Collection<T>.InsertItem(Int32, T).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMoveElement
Moves the element at index currentIndex to the indexToMoveTo index.
Protected methodNotifyChange
Notifies a list change to observers with the parameters passed in.
Protected methodOnAddingItem
Called right before the item passed in is about to be added to this list. Use this method to do event handler housekeeping on elements in this list.
Protected methodOnAddingItemComplete
Called right after the item passed in has been added to the list
Protected methodOnClearing
Called right before the clear action starts. Use this method to do event handler housekeeping on elements in this list.
Protected methodOnClearingComplete
Called right after the clear action has been completed.
Protected methodOnElementPropertyChanged
Called when the PropertyChanged event was raised by an element in this list.
Protected methodOnRemovingItem
Called right before the item passed in is about to be removed from this list. Use this method to do event handler housekeeping on elements in this list.
Protected methodOnRemovingItemComplete
Called right after the item passed in has been removed from this list.
Protected methodPerformSyncedAction(Action)
Performs the specified action, either inside a lock on SyncRoot if this list is Synchronized, or normally, if this list isn't synchronized.
Protected methodPerformSyncedAction<TFunc>(Func<TFunc>)
Performs the specified action, either inside a lock on SyncRoot if this list is Synchronized, or normally, if this list isn't synchronized.
Public methodRemove (Inherited from Collection<T>.)
Public methodRemoveAt (Inherited from Collection<T>.)
Public methodRemoveIndex
Removes the PropertyDescriptor from the indexes used for searching.
Protected methodRemoveItem (Overrides Collection<T>.RemoveItem(Int32).)
Public methodRemoveSort
Removes any sort applied using ApplySort(PropertyDescriptor, ListSortDirection).
Public methodResetBindings
Resets the bindings. Raises a ListChanged.Reset event
Protected methodSetItem
Replaces the element at the specified index.
(Overrides Collection<T>.SetItem(Int32, T).)
Public methodToString
Returns a String that represents the current Object.
(Overrides Object.ToString().)
Top
Events
  NameDescription
Public eventElementAdding
Raised when an element is about to be added. The addition of the element can be cancelled through the event arguments.
Public eventElementRemoved
Raised when an element was removed from this list. The element removed is contained in the event arguments. This event is necessary to be able to retrieve a removed element after it was removed from the list by an observer, as ListChanged only contains indexes, and the index of a removed element isn't valid after it's been removed from the list.
Public eventElementRemoving
Raised when an element is about to be removed. The removal of the element can be cancelled through the event arguments.
Public eventListChanged
Occurs when the list changes or an item in the list changes.
Public eventListClearing
Raised when this list is about to be cleared completely. The clearing of the list can be cancelled through the event arguments.
Top
Extension Methods
  NameDescription
Public Extension MethodBinarySearch<T>
Searches for the element specified in the sorted list specified using binary search http://en.wikipedia.org/wiki/Binary_search. The algorithm is re-implemented here to be able to search in any sorted IList implementing data structure (.NET's BCL only implements BinarySearch on arrays and List(Of T). If no IComparer(Of T) is available, try using Algorithmia's ComparisonBasedComparer,
(Defined by IListExtensionMethods.)
Public Extension MethodToReadOnlyCollection<TDestination>
Converts the enumerable to a ReadOnlyCollection.
(Defined by IEnumerableExtensionMethods.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIList.Add
Adds an item to the IList.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodIList.Contains
Determines whether the IList contains a specific value.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodICollection.CopyTo
Copies the elements of the ICollection to an Array, starting at a particular Array index.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodIEnumerable.GetEnumerator
Returns an enumerator that iterates through a collection.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodIList.IndexOf
Determines the index of a specific item in the IList.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodIList.Insert
Inserts an item into the IList at the specified index.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyIList.IsFixedSize
Gets a value indicating whether the IList has a fixed size.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyICollection<T>.IsReadOnly (Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyIList.IsReadOnly
Gets a value indicating whether the IList is read-only.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyICollection.IsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
(Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyIList.Item
Gets or sets the element at the specified index.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate methodIList.Remove
Removes the first occurrence of a specific object from the IList.
(Inherited from Collection<T>.)
Explicit interface implementationPrivate propertyICollection.SyncRoot
Gets an object that can be used to synchronize access to the ICollection.
(Inherited from Collection<T>.)
Top
Remarks
This class implements IBindingList and not WPF's INotifyCollectionChanged, because the latter isn't recognized by Winforms controls, hence the IBindingList interface implementation. Due to the nature of IBindingList, an extra event has been added for retrieving a removed element by an observer

This class can be a synchronized collection by passing true for isSynchronized in the constructor. To synchronize access to the contents of this class, lock on the SyncRoot object.
See Also
Inheritance Hierarchy
System.Object
  System.Collections.ObjectModel.Collection<T>
    SD.Tools.Algorithmia.GeneralDataStructures.CommandifiedList<T>
      SD.LLBLGen.Pro.ApplicationCore.DerivedModel.DerivedModelDefinitionList
      SD.LLBLGen.Pro.ApplicationCore.DerivedModel.DocumentDefinitionList<T>
      SD.LLBLGen.Pro.ApplicationCore.DerivedModel.DocumentFieldDefinitionList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.FieldElementCoreList<TField>
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.FieldRelationshipList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.ForfList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.GroupableModelElementDefinitionList<TElement>
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.ModelViews.ModelViewList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.TypedLists.TypedListDefinitionList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.TypedLists.TypedListFieldList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.TypeShortcutBindingList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.UniqueConstraintList
      SD.LLBLGen.Pro.ApplicationCore.EntityModel.ValueTypeDefinitionList
      SD.LLBLGen.Pro.ApplicationCore.Mapping.FieldMappingList
      SD.Tools.Algorithmia.GeneralDataStructures.KeyedCommandifiedList<T, TKeyValue>