CodeFlightHub.CorePackets.QuickExtend 1.0.1

dotnet add package CodeFlightHub.CorePackets.QuickExtend --version 1.0.1
                    
NuGet\Install-Package CodeFlightHub.CorePackets.QuickExtend -Version 1.0.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="CodeFlightHub.CorePackets.QuickExtend" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeFlightHub.CorePackets.QuickExtend" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="CodeFlightHub.CorePackets.QuickExtend" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeFlightHub.CorePackets.QuickExtend --version 1.0.1
                    
#r "nuget: CodeFlightHub.CorePackets.QuickExtend, 1.0.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.
#:package CodeFlightHub.CorePackets.QuickExtend@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeFlightHub.CorePackets.QuickExtend&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=CodeFlightHub.CorePackets.QuickExtend&version=1.0.1
                    
Install as a Cake Tool

About QuickExtend

QuickExtend is a library of extension methods that provide additional functionality to various .Net Core projects. This library aims to quickly solve common and recurring needs, usually facilitating the use of HttpClient to manage HTTP requests, from string manipulation to date and time operations, from Reflection operations to collection operations.

  • Total 211 extension method
  • Total 457 unit test
Extension Name Method Count
Array 17
Collection 6
DateTime 21
Dictionary 17
Enum 2
Enumerable 9
HttpClient 30
IPAddress 36
Reflection 10
Stream 12
String 25
Task 4
Uri 22

Array

  • T[] Flatten<T>(this T[][] array) : Flattens a jagged array (array of arrays) into a one-dimensional array.
  • T[] FilterElements<T>(this T[] array, Func<T, bool> predicate) : Filters the elements of an array based on a specified predicate function and returns a new array containing the filtered elements in reverse order.

String

  • String? CapitalizeFirstLetter(this string? input) : Capitalizes the first letter of each word in a string.
  • TimeSpan ToTimeSpan(this string input, TimeSpan defaultValue = default) : Converts a string to a TimeSpan. Returns the default value if conversion fails.

Reflection

  • void InvokeMethodByName(this object obj, string methodName, params object[] parameters) : Invokes the specified method by name on the provided object with the given parameters.
  • void SetPropertyByName(this object obj, string propertyName, object newValue) : Extension method that sets the value of a specified property for an object.

etc..

IEnumerable Paginate

    /// <summary>
    /// Paginates the items in a collection based on a specified page number and page size.
    /// </summary>
    /// <typeparam name="T">Type of collection items.</typeparam>
    /// <param name="source">Collection to be paginated.</param>
    /// <param name="pageNumber">Requested page number.</param>
    /// <param name="pageSize">Page size.</param>
    /// <returns>Collection paginated based on the specified page number and size.</returns>
    public static IEnumerable<T> Paginate<T>(this IEnumerable<T> source, int pageNumber, int pageSize)
    {
        if (source == null)
            throw new ArgumentNullException(nameof(source));

        return source.Skip((pageNumber - 1) * pageSize).Take(pageSize);
    }

Example Basic Usage QuickExtend

using CodeFlightHub.CorePackets.QuickExtend;

    internal class Program
    {
        static void Main(string[] args)
        {
            IEnumerable<int> source = Enumerable.Range(1, 100);
            int pageNumber = 3;
            int pageSize = 5;

            var result = source.Paginate(pageNumber, pageSize);

            result.ForEach(x => Console.WriteLine(x)); // 11 12 13 14 15
        }
    }

License

CodeFlightHub.CorePackets is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.1 227 4/7/2024
1.0.0 183 4/7/2024