# ParallelEx **Repository Path**: handloong/ParallelEx ## Basic Information - **Project Name**: ParallelEx - **Description**: 把X个数据按照Y分批大小分成M批,按照N个线程数去处理. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-07 - **Last Updated**: 2025-08-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ParallelEx ParallelEx is a .NET library designed to simplify parallel processing and pagination. It provides a set of utility methods that enable you to easily paginate through collections and improve processing efficiency using multithreading. ## Features - **Pagination Processing**: Split large collections into smaller chunks for processing. - **Parallel Processing**: Utilize multiple threads to execute tasks in parallel, enhancing performance. - **Support for Synchronous and Asynchronous Operations**: Suitable for various application scenarios, including asynchronous programming models. ## Key Functions - `PageHelper.PageEach`: Paginate through a collection in specified sizes and perform synchronous operations on each page. - `PageHelper.PageEachAsync`: Paginate asynchronously through a collection in specified sizes and perform asynchronous operations on each page. - `ParallelHelper.ForEach`: Process paginated data in parallel, supporting both synchronous and asynchronous operations. ## Usage Examples ### Pagination Using PageHelper ```csharp var items = Enumerable.Range(1, 100); PageHelper.PageEach(items, 10, page => { // Process each page Console.WriteLine($"Page {page.First()} - {page.Last()}"); }); ``` ### Parallel Processing Using ParallelHelper ```csharp var items = Enumerable.Range(1, 100); ParallelHelper.ForEach(items, 10, 4, (index, page) => { // Process each page in parallel Console.WriteLine($"Processing Page {index} in parallel."); }); ``` ## Installation You can install ParallelEx via NuGet: ``` Install-Package ParallelEx ``` Or use the `nuget.bat` script within the project. ## Build and Test The project can be built using the `ParallelEx.csproj` file and can be compiled and tested in Visual Studio or via the .NET CLI. ## Contributions Code contributions are welcome! Please submit Pull Requests to the [Gitee repository](https://gitee.com/handloong/ParallelEx). ## License ParallelEx uses the MIT License. For more details, please refer to the `ParallelEx.nuspec` file included in the project.