MikValSor.ObjectPool 1.0.0

.NET Libaray for Object pools. Object pools can improve application performance in situations where you require multiple instances of a class and the class is expensive to create or destroy. When a client program requests a new object, the object pool first attempts to provide one that has already been created and returned to the pool. If none is available, only then is a new object created.

Install-Package MikValSor.ObjectPool -Version 1.0.0
dotnet add package MikValSor.ObjectPool --version 1.0.0
<PackageReference Include="MikValSor.ObjectPool" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MikValSor.ObjectPool --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

.NET Libaray for Object pools. Object pools can improve application performance in situations where you require multiple instances of a class and the class is expensive to create or destroy. When a client program requests a new object, the object pool first attempts to provide one that has already been created and returned to the pool. If none is available, only then is a new object created.

Example:

void Example()
{
	var pool = new MikValSor.Collections.ObjectPool<System.Collections.Generic.List<int>>(
		() => new System.Collections.Generic.List<int>()
	);

	// Create a high demand for objects.
	System.Threading.Tasks.Parallel.For(0, 1000000, (i, loopState) =>
	{
		pool.Use(list => list.Add(i));
	});

	System.Console.WriteLine($"Pool Count: {pool.Count}");

	System.Console.ReadLine();
}

/**
	Output:
	Pool Count: 8
**/

.NET Libaray for Object pools. Object pools can improve application performance in situations where you require multiple instances of a class and the class is expensive to create or destroy. When a client program requests a new object, the object pool first attempts to provide one that has already been created and returned to the pool. If none is available, only then is a new object created.

Example:

void Example()
{
	var pool = new MikValSor.Collections.ObjectPool<System.Collections.Generic.List<int>>(
		() => new System.Collections.Generic.List<int>()
	);

	// Create a high demand for objects.
	System.Threading.Tasks.Parallel.For(0, 1000000, (i, loopState) =>
	{
		pool.Use(list => list.Add(i));
	});

	System.Console.WriteLine($"Pool Count: {pool.Count}");

	System.Console.ReadLine();
}

/**
	Output:
	Pool Count: 8
**/

Release Notes

1.0.0 - Initial release.

  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 3,406 5/28/2018