CLSS.Types.SortedAction
1.1.1
dotnet add package CLSS.Types.SortedAction --version 1.1.1
NuGet\Install-Package CLSS.Types.SortedAction -Version 1.1.1
<PackageReference Include="CLSS.Types.SortedAction" Version="1.1.1" />
paket add CLSS.Types.SortedAction --version 1.1.1
#r "nuget: CLSS.Types.SortedAction, 1.1.1"
// Install CLSS.Types.SortedAction as a Cake Addin
#addin nuget:?package=CLSS.Types.SortedAction&version=1.1.1
// Install CLSS.Types.SortedAction as a Cake Tool
#tool nuget:?package=CLSS.Types.SortedAction&version=1.1.1
CLSS.Types.SortedAction
Problem
The default System.Action
delegate determines order-of-execution by registration order. This can be inflexible for the system you are building.
Solution
SortedAction
determines order-of-execution by the key you associate with each action.
When you declare a SortedAction
instance, the first type to give it is the key type, called TKey
. This type will determine the memory footprint of the keys and the number of possible key values. Types following TKey
are argument types.
Tkey
can be any type, but preferably types that implement System.IComparable<T>
.
SortedAction
inherits from SortedList
and uses its methods for adding and removing elements.
Example:
using CLSS;
var OnEvent = new SortedAction<byte, int, string>();
OnEvent.Add(93, (n, s) => Console.WriteLine($"3rd action"));
OnEvent[25] = (n, s) => Console.WriteLine($"1st action");
OnEvent[68] = (n, s) => Console.WriteLine($"2nd action");
OnEvent.Invoke(16, "foo");
// Output:
// 1st action
// 2nd action
// 3rd action
Note #1: Upon using CLSS;
, Invoke
syntax will also be available to all of the following types: SortedList<TKey, Action>
, SortedList<TKey, Action<T>>
, SortedList<TKey, Action<T1, T2>>
, etc...
Note #2: Unlike most CLSS packages which target minimum .NET Standard 1.0, this package targets minimum .NET Standard 1.3.
This package is a part of the C# Language Syntactic Sugar suite.
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.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net46 was computed. 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.3
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added language-sensitive syntax highlighting in README file.