Skip to content

Utils.LimitableStringCollection

JaykeBird edited this page Feb 21, 2023 · 6 revisions

Back to home | Back to Reference | View raw text

LimitableStringCollection class

Description

A string collection where a limit can be applied to the number of items allowed. This collection can be observed via the CollectionChanged event.

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi.Utils
  SolidShineUi.Utils.LimitableStringCollection[[LimitableStringCollection]]
  end
  subgraph System.Collections.ObjectModel
System.Collections.ObjectModel.ObservableCollection_1[[ObservableCollection]]
  end
System.Collections.ObjectModel.ObservableCollection_1 --> SolidShineUi.Utils.LimitableStringCollection
Loading

Members

Properties

Public properties

Type Name Methods
int MaxCount
Get or set the maximum number of items allowed for this collection. If the maximum count is less than 0, then the collection is allowed to grow to any size without a limit.
get, set

Methods

Public methods

Returns Name
void Add(string item)
Adds an object to the end of this collection.
void Insert(int index, string item)
Insert an object into the collection at the specified index.

Details

Summary

A string collection where a limit can be applied to the number of items allowed. This collection can be observed via the CollectionChanged event.

Inheritance

  • ObservableCollection<string>

Constructors

LimitableStringCollection [1/2]

public LimitableStringCollection()
Summary

Create a LimitableStringCollection.

LimitableStringCollection [2/2]

public LimitableStringCollection(int maxCount)
Arguments
Type Name Description
int maxCount The maximum number of items allowed in this collection.
Summary

Create a LimitableStringCollection, with a max limit of items preset.

Methods

Add

public void Add(string item)
Arguments
Type Name Description
string item The item to add.
Summary

Adds an object to the end of this collection.

Remarks

If the LimitableStringCollection's ItemAdding event is handled, it is possible that the addition of this item could be cancelled. If the item being added would bring the count over the maximum count of items allowed (via LimitableStringCollection.MaxCount ), then this item replaces the last item already in the collection (with the last item being removed before this item is added in).

Insert

public void Insert(int index, string item)
Arguments
Type Name Description
int index The zero-based index at which the item should be inserted.
string item The item to add.
Summary

Insert an object into the collection at the specified index.

Remarks

If the LimitableStringCollection's ItemAdding event is handled, it is possible that the insertion of this item could be cancelled. If the item being inserted would bring the count over the maximum count of items allowed (via LimitableStringCollection.MaxCount ), then this item is inserted after the current last item in the collection is removed.

Properties

MaxCount

public int MaxCount { get; set; }
Summary

Get or set the maximum number of items allowed for this collection. If the maximum count is less than 0, then the collection is allowed to grow to any size without a limit.

Events

ItemAdding

public event ItemAddingStringEventHandler ItemAdding
Summary

Raised prior to an item being added to this collection, with the ability to cancel adding the item.

Delegates

ItemAddingStringEventHandler

public delegate void ItemAddingStringEventHandler(object sender, ItemAddingStringEventArgs e)
Arguments
Type Name Description
object sender
ItemAddingStringEventArgs e

Generated with ModularDoc

Clone this wiki locally