StructList 1.2.0
Since 1.3.0, I added 'pkar' prefix to package ID
dotnet add package StructList --version 1.2.0
NuGet\Install-Package StructList -Version 1.2.0
<PackageReference Include="StructList" Version="1.2.0" />
paket add StructList --version 1.2.0
#r "nuget: StructList, 1.2.0"
// Install StructList as a Cake Addin #addin nuget:?package=StructList&version=1.2.0 // Install StructList as a Cake Tool #tool nuget:?package=StructList&version=1.2.0
Helpers bases for items and lists.
Almost every app writes/read data from file, and in every app we have to place same code... This Nuget should help with this.
BaseStruct
It is base for class/struct you use in your code. If your class inherits from BaseStruct, you will get:
two debugging helpers, to dump properties values:
Function DumpAsText() As String // dump of all properties' values (in something like table) Function DumpAsJSON(Optional bSkipDefaults As Boolean = False) As String // similar, but gives full dump of tree of properties as JSON dump
methods you can utilize in code, and sometimes even you can love it:
Function Clone() As Object // deep Clone of item (dump to JSON and read it to new item) Sub CopyFrom(anyObject) // copy all properties/fields from anyObject, if their names matches Sub CopyTo(anyObject) // copy all properties/fields to anyObject, if their names matches
BaseList
It is base for lists backed by JSON file; in many cases your app would be relieved from Nugetting JSON. Using:
VB: Class YourList Inherits BaseList(Of YourClass)
C#: class YourList : BaseList<YourClass>
Maybe you would like to override one method, called by Load if file is empty. In overrided method you can add default entries to list.
Protected Overridable Sub InsertDefaultContent()
constructor
You have to give folder for file, and you can override default file name.
New(sFolder As String, Optional sFileName As String = "items.json")
operations on data file
Overridable Function Load() As Boolean
Overridable Function Import(string) As Boolean [since 1.2.0]
Overridable Function Save(Optional bIgnoreNulls As Boolean = False) As Boolean
Function GetFileDate() As Date
Function IsObsolete(iDays As Integer)
proxies for internal list
Function GetList() As List(Of TYP)
Function Count() As Integer
Sub Clear()
Sub Add(oNew As TYP)
Sub Remove(oDel As TYP)
Function Find(match As Predicate(Of TYP)) As TYP
Sub Remove(match As Predicate(Of TYP))
other functions
Function LoadItem(sJSON As String) As TYP
BaseDict [since 1.2.0]
It is base for dictionary backed by JSON file; in many cases your app would be relieved from Nugetting JSON. Using:
VB: Class YourList Inherits BaseDict(Of TypeOfKey, TypeOfValue)
C#: class YourList : BaseDict<TKey, TValue>
Maybe you would like to override one method, called by Load if file is empty. In overrided method you can add default entries to dictionary.
Protected Overridable Sub InsertDefaultContent()
constructor
You have to give folder for file, and you can override default file name.
New(sFolder As String, Optional sFileName As String = "items.json")
operations on data file
Overridable Function Load() As Boolean
Overridable Function Import(string) As Boolean
Overridable Function Save(Optional bIgnoreNulls As Boolean = False) As Boolean
Function GetFileDate() As Date
Function IsObsolete(iDays As Integer)
proxies for internal list
Function GetDictionary() As Dictionary(Of TKEY, TVALUE)
Function Count() As Integer
Sub Clear()
Function TryAdd(oNew As KeyValuePair(Of TKEY, TVALUE)) As Boolean
Function ContainsKey(key As TKEY) As Boolean
Function TryAdd(key As TKEY, value As TVALUE) As Boolean
Sub Remove(oDel As KeyValuePair(Of TKEY, TVALUE))
Sub Remove(key As TKEY)
Function Item(key As TKEY) As TVALUE
Function TryGetValue(key As TKEY, ByRef value As TVALUE) As Boolean
other functions
Function LoadItem(sJSON As String) As TYP
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.4 is compatible. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.4
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 13.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on StructList:
Package | Downloads |
---|---|
pkar.nuget.MPK
This package is only for Kraków, Poland - wrapper for public transport services. Although it can be used (in part) also for other TTSS based services. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Added BaseDict class and BaseList.Import method