Geranium.Toposort 1.0.2

dotnet add package Geranium.Toposort --version 1.0.2                
NuGet\Install-Package Geranium.Toposort -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Geranium.Toposort" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Geranium.Toposort --version 1.0.2                
#r "nuget: Geranium.Toposort, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Geranium.Toposort as a Cake Addin
#addin nuget:?package=Geranium.Toposort&version=1.0.2

// Install Geranium.Toposort as a Cake Tool
#tool nuget:?package=Geranium.Toposort&version=1.0.2                

Geranium.Toposort

NuGet version

Interface and class, base alghoritm-implementations, for Types sorted according to dependencies from each other.

Example

Define BaseModule class extended from Toposort, create 3 inheritors, and set dependencies of types:

class BaseModule : ToposortType { }
class Module1 : BaseModule { }
class Module2 : BaseModule {
    protected override void SetDependencies() => this.DependsOn<Module3>();
}
class Module3 : BaseModule {
    protected override void SetDependencies() => this.DependsOn<Module1>();
}

Sort instances:

[TestMethod]
public void DependenciesByTypesTest()
{
    var m1 = new Module1();
    var m2 = new Module2();
    var m3 = new Module3();

    var modules = new BaseModule[] { m1,m2,m3 };
    var sorted = modules.Sort().ToArray();

    Assert.AreEqual(m1, sorted[0]);
    Assert.AreEqual(m3, sorted[1]);
    Assert.AreEqual(m2, sorted[2]);
}

Components

There is base interfacem but better use implementations, and extension methods with generic type checks:

  • Itoposort - base interface, use it when u can't use base class
  • ToposortType - base class implemented all logic
  • ToposortExtensions.Sort - implicit extension method for topo sorting
  • ToposortExtensions.TopoSort - explicit extension method for topo sorting
  • delegate Toposorting - delegate "extension point"

Extensions

Interface

You can implement your custom IToposort class, for example: set dependencies not by type and on runtime.

Sorting

Additionaly, you can pass your own delegate Toposorting<TToposort> in Sort and TopoSort methods.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net46 is compatible.  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 tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Geranium.Toposort:

Package Downloads
Geranium.Modules

Modules

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 3,935 5/15/2023