Class SerializableHashSet<T>
- Namespace
- ElectricDrill.SoapRpgFramework.Utils
- Assembly
- com.electricdrill.soap-rpg-framework.Runtime.dll
A serializable hash set implementation that can be displayed and edited in the Unity Inspector. Provides all standard hash set functionality while maintaining Unity serialization compatibility.
[Serializable]
public class SerializableHashSet<T>
Type Parameters
TThe type of elements in the hash set
- Inheritance
-
objectSerializableHashSet<T>
Properties
Count
Gets the number of elements contained in the hash set.
public int Count { get; }
Property Value
- int
IsReadOnly
Gets a value indicating whether the hash set is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
Methods
Add(T)
Adds the specified element to the hash set.
public void Add(T item)
Parameters
itemTThe element to add
Clear()
Removes all elements from the hash set.
public void Clear()
Contains(T)
Determines whether the hash set contains the specified element.
public bool Contains(T item)
Parameters
itemTThe element to locate
Returns
- bool
True if the hash set contains the element; otherwise, false
CopyTo(T[], int)
Copies the elements of the hash set to an array, starting at the specified array index.
public void CopyTo(T[] array, int arrayIndex)
Parameters
arrayT[]The destination array
arrayIndexintThe zero-based index in array at which copying begins
GetEnumerator()
Returns an enumerator that iterates through the hash set.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator for the hash set
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo with the data needed to serialize the hash set.
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoThe SerializationInfo to populate
contextStreamingContextThe destination for this serialization
OnAfterDeserialize()
Reconstructs the internal hash set from the serialized list format. Called automatically by Unity after deserialization occurs.
public void OnAfterDeserialize()
OnBeforeSerialize()
Converts the internal hash set to a serialized list format for Unity serialization. Called automatically by Unity before serialization occurs.
public void OnBeforeSerialize()
Remove(T)
Removes the specified element from the hash set.
public bool Remove(T item)
Parameters
itemTThe element to remove
Returns
- bool
True if the element was successfully removed; otherwise, false
RemoveWhere(Predicate<T>)
Removes all elements that match the conditions defined by the specified predicate.
public int RemoveWhere(Predicate<T> match)
Parameters
matchPredicate<T>The predicate that defines the conditions of the elements to remove
Returns
- int
The number of elements that were removed