Class PpkOnDriveDevCodeBase<T>
- Namespace
- SunamoDevCode
- Assembly
- SunamoDevCode.dll
Abstract base class for persistent collections stored on drive, with file watching and auto-save capabilities.
public abstract class PpkOnDriveDevCodeBase<T> : List<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
Type Parameters
TType of elements in the collection.
- Inheritance
-
List<T>PpkOnDriveDevCodeBase<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
PpkOnDriveDevCodeBase(PpkOnDriveDevCodeArgs)
Initializes the persistent collection with the specified arguments, creating the file if needed and optionally watching for changes.
public PpkOnDriveDevCodeBase(PpkOnDriveDevCodeArgs args)
Parameters
argsPpkOnDriveDevCodeArgsConfiguration arguments for persistence behavior.
Fields
args
Configuration arguments for persistence behavior.
protected PpkOnDriveDevCodeArgs args
Field Value
Methods
Add(IList<T>)
Adds multiple items to the collection, saving after each addition.
public Task Add(IList<T> items)
Parameters
itemsIList<T>Items to add.
Returns
Add(T)
Adds an item if not already present and the value is non-empty, then saves to disk.
public Task<bool> Add(T value)
Parameters
valueTItem to add.
Returns
AddWithoutSave(T)
Adds an item to the collection without triggering a save to disk.
public void AddWithoutSave(T value)
Parameters
valueTItem to add.
Clear()
Clears all items and saves the empty collection to disk.
public Task Clear()
Returns
Load()
Loads the collection contents from the backing file on disk.
public abstract Task Load()
Returns
Remove(T)
Removes the specified item and saves the collection to disk.
public Task Remove(T value)
Parameters
valueTItem to remove.
Returns
RemoveAll()
Removes all items from the collection and clears the backing file.
public Task RemoveAll()
Returns
Save()
Persists the current collection contents to the backing file on disk.
public Task Save()
Returns
ToString()
Returns all items as a newline-separated string.
public override string ToString()
Returns
- string
String representation of all items.