MagicPool 1.3.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MagicPool --version 1.3.1
NuGet\Install-Package MagicPool -Version 1.3.1
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="MagicPool" Version="1.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MagicPool --version 1.3.1
#r "nuget: MagicPool, 1.3.1"
#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 MagicPool as a Cake Addin
#addin nuget:?package=MagicPool&version=1.3.1

// Install MagicPool as a Cake Tool
#tool nuget:?package=MagicPool&version=1.3.1

MagicPool

What is MagicPool?

MagicPool is a simple object/instance pool

What feature dose MagicPool has?

  • Automic distinguish the Object Type, may be you need to put many types of objects into pools, in usual you need specify a String or thomething other to indicate whitch pool in pools that you want to use, but in MagicPool you don't neet to do like that.

  • take fully control in two ways.

    may be the object need to be init when it created, or do something when you get it or return it ,in MagicPool you can use Action<> to imp this demand when you use InstancePool<T> imp your own object pool.

    when you use "Pools" to store objects, you can't specify the handler for the "Pools",but you can let your class imp the interface IReusable, then the "Pools" will do the things that you want to do for objects when create object,get object,return object.

How to use.

  • Use "Pools", this will automic distinguish type.

    Pools p = new Pools(10);
    var res = p.Instance<SomeClass>();
    p.Return(res);
    
  • Use "InstancePool<>".

    // decleare the pool
    public InstancePool<SomeClass> Pool = new InstancePool<SomeClass>(
    (sc) => { sc.Name = "xxx"; },
    null,
    (sc) =>
    {
        if (sc.Name != "xxx")
        {
            sc.DoSomething();
        }
    },
    10
    );
    
    // get a instance of SomeClass
    var instance= Pool.Instance();
    
    // return a instance
    Pool.Return(instance);
    
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.

Version Downloads Last updated

1 . rename Pools to AutomicPool
2 . add NamedSington, use for multiple sington .
3 . refactor most code, add SpecilePool, now MagicPool support class that have private constructor or constructor has params.