Class ObservableSet<T>
Implements an Observable set of Items.
Inheritance
Namespace: Cortex.Net.Types
Assembly: Cortex.Net.dll
Syntax
public sealed class ObservableSet<T> : ISet<T>, ICollection<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IAtomProvider
Type Parameters
Name | Description |
---|---|
T | The type parameter to work on. |
Constructors
| Improve this Doc View SourceObservableSet(ISharedState, IEnhancer, IEnumerable<T>, String)
Initializes a new instance of the ObservableSet<T> class.
Declaration
public ObservableSet(ISharedState sharedState, IEnhancer enhancer, IEnumerable<T> initialItems, string name = null)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The ISharedState instance this ObservableSet belongs to. |
IEnhancer | enhancer | The IEnhancer implementation to use. |
IEnumerable<T> | initialItems | The initialItems to use. |
System.String | name | The name of the ObservableSet. |
ObservableSet(ISharedState, IEnhancer, String)
Initializes a new instance of the ObservableSet<T> class.
Declaration
public ObservableSet(ISharedState sharedState, IEnhancer enhancer, string name = null)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The ISharedState instance this ObservableSet belongs to. |
IEnhancer | enhancer | The IEnhancer implementation to use. |
System.String | name | The name of the ObservableSet. |
Properties
| Improve this Doc View SourceCount
Gets the number of elements contained in the ObservableSet<T>.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsFixedSize
Gets a value indicating whether the ObservableSet<T> has a fixed size.
Declaration
public bool IsFixedSize { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsReadOnly
Gets a value indicating whether the ObservableSet<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSynchronized
Gets a value indicating whether access to the ObservableSet<T> is synchronized (thread safe).
Declaration
public bool IsSynchronized { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets the name of the ObservableSet<T>.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
SharedState
Gets the shared state this ObservableSet<T> operates on.
Declaration
public ISharedState SharedState { get; }
Property Value
Type | Description |
---|---|
ISharedState |
SyncRoot
Gets an object that can be used to synchronize access to the ObservableSet<T>.
Declaration
public object SyncRoot { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
| Improve this Doc View SourceAdd(T)
Adds an item to the ObservableSet<T>.
Declaration
public bool Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to add to the ObservableSet<T>. |
Returns
Type | Description |
---|---|
System.Boolean | True if the item was added, false otherwise. |
Clear()
Removes all elements from the ObservableSet<T>.
Declaration
public void Clear()
Contains(T)
Determines whether the ObservableSet<T> contains a specific value.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the ObservableSet<T>. |
Returns
Type | Description |
---|---|
System.Boolean | true if item is found in the ObservableSet<T>; otherwise, false. |
CopyTo(T[], Int32)
Copies the elements of the ObservableSet<T> to an System.Set, starting at a particular System.Set index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The one-dimensional System.Set that is the destination of the elements copied from ObservableSet<T>. The System.Set must have zero-based indexing. |
System.Int32 | arrayIndex | The zero-based index in array at which copying begins. |
ExceptWith(IEnumerable<T>)
Removes all elements in the specified collection from the current ObservableSet<T> object.
Declaration
public void ExceptWith(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection of items to remove from the System.Collections.Generic.HashSet`1 object. |
GetEnumerator()
Returns an enumerator that iterates through the ObservableSet<T>.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> | An enumerator that can be used to iterate through the ObservableSet<T>. |
IntersectWith(IEnumerable<T>)
Modifies the current System.Collections.Generic.HashSet`1 object to contain only elements that are present in that object and in the specified collection.
Declaration
public void IntersectWith(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
IsProperSubsetOf(IEnumerable<T>)
Determines whether a System.Collections.Generic.HashSet`1 object is a proper subset of the specified collection.
Declaration
public bool IsProperSubsetOf(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object is a proper subset of other; otherwise, false. |
IsProperSupersetOf(IEnumerable<T>)
Determines whether a System.Collections.Generic.HashSet`1 object is a proper superset of the specified collection.
Declaration
public bool IsProperSupersetOf(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object is a proper superset of other; otherwise, false. |
IsSubsetOf(IEnumerable<T>)
Determines whether a System.Collections.Generic.HashSet`1 object is a subset of the specified collection.
Declaration
public bool IsSubsetOf(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object is a subset of other; otherwise, false. |
IsSupersetOf(IEnumerable<T>)
Determines whether a System.Collections.Generic.HashSet`1 object is a superset of the specified collection.
Declaration
public bool IsSupersetOf(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object is a superset of other; otherwise, false. |
Overlaps(IEnumerable<T>)
Determines whether the current System.Collections.Generic.HashSet`1 object and a specified collection share common elements.
Declaration
public bool Overlaps(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object and other share at least one common element; otherwise, false. |
Remove(T)
Removes the first occurrence of a specific object from the ObservableSet<T>.
Declaration
public bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to remove from the ObservableSet<T>. The value can be null for reference types. |
Returns
Type | Description |
---|---|
System.Boolean | True if item is successfully removed; otherwise, false. This method also returns false if item was not found in the ObservableSet<T>. |
SetEquals(IEnumerable<T>)
Determines whether a System.Collections.Generic.HashSet`1 object and the specified collection contain the same elements.
Declaration
public bool SetEquals(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Collections.Generic.HashSet`1 object is equal to other; otherwise, false. |
SymmetricExceptWith(IEnumerable<T>)
Modifies the current System.Collections.Generic.HashSet`1 object to contain only elements that are present either in that object or in the specified collection, but not both.
Declaration
public void SymmetricExceptWith(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
UnionWith(IEnumerable<T>)
Modifies the current System.Collections.Generic.HashSet`1 object to contain all elements that are present in itself, the specified collection, or both.
Declaration
public void UnionWith(IEnumerable<T> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | other | The collection to compare to the current System.Collections.Generic.HashSet`1 object. |
Events
| Improve this Doc View SourceChange
Event that fires before the value will change.
Declaration
public event EventHandler<ObservableSetCancellableEventArgs> Change
Event Type
Type | Description |
---|---|
EventHandler<ObservableSetCancellableEventArgs> |
Changed
Event that fires after the value has changed.
Declaration
public event EventHandler<ObservableSetEventArgs> Changed
Event Type
Type | Description |
---|---|
EventHandler<ObservableSetEventArgs> |
Explicit Interface Implementations
| Improve this Doc View SourceIAtomProvider.Atom
Gets the atom.
Declaration
IAtom IAtomProvider.Atom { get; }
Returns
Type | Description |
---|---|
IAtom |