Kotz.Extensions 2.3.0-nightly-067

This is a prerelease version of Kotz.Extensions.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kotz.Extensions --version 2.3.0-nightly-067                
NuGet\Install-Package Kotz.Extensions -Version 2.3.0-nightly-067                
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="Kotz.Extensions" Version="2.3.0-nightly-067" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kotz.Extensions --version 2.3.0-nightly-067                
#r "nuget: Kotz.Extensions, 2.3.0-nightly-067"                
#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 Kotz.Extensions as a Cake Addin
#addin nuget:?package=Kotz.Extensions&version=2.3.0-nightly-067&prerelease

// Install Kotz.Extensions as a Cake Tool
#tool nuget:?package=Kotz.Extensions&version=2.3.0-nightly-067&prerelease                

Kotz.Extensions

Defines the following extension methods:

  • Array Extensions
    • Several wrappers for System.Array static methods.
  • Assembly Extensions
    • GetConcreteTypes: Gets all concrete types from the current assembly.
    • GetAbstractTypes: Gets all abstract types from the current assembly.
    • GetConcreteTypesOf: Gets the concrete types from the current assembly that derive from another type.
    • GetAbstractTypesOf: Gets the abstract types from the current assembly that derive from another type.
  • Char Extensions
    • Several wrappers for System.Char static methods.
  • DateTimeOffset Extensions
    • StartOfDay: Gets the beginning of the day for the current DateTimeOffset object.
  • Enum Extensions
    • HasOneFlag: Checks if the current enum has at least one of the provided bit flags.
    • ToFlags: Flattens a collection of enums to a single enum value that contains all bit flags from the enums in the collection. It's the opposite of ToValues().
    • ToStrings: Creates a collection of human-readable strings of the current enum.
    • ToValues: Segregates bit flags into a collection of enum values of their own. It's the opposite of ToFlags().
    • ToggleFlag: Returns an enum with the provided bit flag set if it's not currently set, and vice-versa.
  • IEnumerable<T> Extensions
    • AtLeast: Checks if the current collection contains at least the specified amount of elements and exits early if it does.
    • ChunkBy: Splits a collection into a collection of collections based on the provided key selector.
    • ContainsOne: Checks if the current collection contains at least one element of a given collection.
    • ContainsSubcollection: Checks if the current collection contains all elements of a given collection.
    • MaxOrDefault: Returns the maximum value in a generic sequence or default if the sequence is empty.
    • MaxByOrDefault: Returns the maximum value in a generic sequence according to a specified key selector function or default if the sequence is empty.
    • MinOrDefault: Returns the minimum value in a generic sequence or default if the sequence is empty.
    • MinByOrDefault: Returns the minimum value in a generic sequence according to a specified key selector function or default if the sequence is empty.
    • NestedFill: Adds a sample object to the inner collections of a collection of collections until they all have the same length.
    • OrderAmount: Sorts the elements of a sequence in ascending order according to how many times they appear in the sequence.
    • OrderDescendingAmount: Sorts the elements of a sequence in descending order according to how many times they appear in the sequence.
    • OrderByAmount: Sorts the elements of a sequence in ascending order according to how many times the selected property appears in the sequence.
    • OrderByDescendingAmount: Sorts the elements of a sequence in descending order according to how many times the selected property appears in the sequence.
    • RandomElement: Gets a random element from the current collection.
    • Split: Splits the current collection into multiple collections based on the specified separator.
    • Tap: Executes an action on every element of the collection. Due to poor performance, this method should only be used for testing purposes!
    • Unique: Gets the symetric difference between all elements in the current and specified collections.
    • When: Fluent version of an if statement.
    • WhenAllAsync: Awaits all tasks in the current IEnumerable<Task> and returns when all of them have completed.
    • WhenAnyAsync: Awaits all tasks in the current IEnumerable<Task> and returns when any of them have completed.
    • ZipOrDefault: Produces a sequence of tuples with elements from the two specified sequences. If one of the sequences is larger than the other, the exceeding elements from the larger sequence get paired with default values.
    • A variety of "To" methods:
      • ToConcurrentDictionary
      • ToQueue
      • ToConcurrentQueue
      • ToImmutableQueue
      • ToPriorityQueue
      • ToStack
      • ToConcurrentStack
      • ToImmutableStack
  • IReadOnlyList<T> Extensions
    • IndexOf: Get the index of the first element that matches a predicate.
    • LastIndexOf: Get the index of the last element that matches a predicate.
    • TryGetValue: safely get an element from the collection, or default(T) if it fails.
  • List<T> Extensions
    • AsSpan: Gets the current list as a Span<T> object.
    • AsReadOnlySpan: Gets the current list as a ReadOnlySpan<T> object.
  • Object Extensions
    • EqualsAny: Checks whether the current object equals any of the specified objects.
  • ReadOnlySpan<T> Extensions
    • AsEnumerable: Enumerates the current span.
  • Span<T> Extensions
    • AsEnumerable: Enumerates the current span.
    • Rotate: Rotates a span from a starting position by the specified amount of indices.
  • String and ReadOnlySpan<char> Extensions
    • Contains: Checks if the current string occurs within at least one of the entries in the provided collection.
    • EndsWith: Checks whether the end of the current string matches any string stored in the provided collection.
    • Equals: Checks whether the current string is equal to any of the provided strings.
    • FirstOccurrenceOf: Returns the "Nth" index of the provided character.
    • GetDigits: Returns a string with all digits present in this string.
    • HasFirstWordOf: Checks if the current string and the provided string contain the same first word.
    • LastOccurrenceOf: Returns the last "Nth" index of the provided character.
    • MaxElementLength: Get the length of the longest string of the current collection.
    • MaxLength: Truncates the string to the maximum specified length.
    • Occurrences: Gets the amount of occurences of a given character in the current string.
    • StartsWith: Checks whether the beginning of the current string matches any string stored in the provided collection.
    • ToPascalCase: Converts the current string to the PascalCase format.
    • ToSnakeCase: Converts the current string to the snake_case format.
    • ToTitleCase: Converts the current string to the Title Case format.
  • StringBuilder Extensions
    • ReplaceAll: Replaces all instances of a substring with another substring, even if the new substring is a substring of the old substring.
    • Remove: Removes the specified string chunks from the current string builder.
    • RemoveAt: Removes the character at the specified index.
    • ToStringAndClear: Returns the string value of the current builder and clears the builder.
    • Trim: Removes all leading and trailing instances of a character from the current string builder.
    • TrimEnd: Removes all trailing instances of a character from the current string builder.
    • TrimStart: Removes all leading instances of a character from the current string builder.

Defines the following types:

  • KotzUtilities: static class with a wide range of helper methods.
    • AddPathToPATHEnvar: Adds a directory path to the PATH environment variable.
    • HasWritePermissionAt: Checks if this application can write to the specified directory.
    • ProgramExists: Checks if a program exists at the specified absolute path or the PATH environment variable.
    • StartProcess: Starts the specified program in the background.
    • TryCreate: Safely creates an object with the specified factory method.
    • TryDeleteFSO: Safely deletes a file or directory.
    • TryDeleteFile: Safely deletes a file.
    • TryDeleteDirectory: Safely deletes a directory.
    • TryMoveFSO: Safely moves a file or directory.
    • TryMoveFile: Safely moves a file.
    • TryMoveDirectory: Safely moves a directory.
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Kotz.Extensions:

Package Downloads
Kotz.Utilities

Provides utility types and methods for common tasks. This is a metapackage that includes all Kotz utility packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.3-nightly-075 84 5/25/2024
2.3.2 103 5/25/2024
2.3.1 98 5/25/2024
2.3.0 97 5/24/2024
2.3.0-nightly-070 82 5/24/2024
2.3.0-nightly-069 90 5/24/2024
2.3.0-nightly-068 85 5/24/2024
2.3.0-nightly-067 84 5/24/2024
2.3.0-nightly-066 87 5/24/2024
2.3.0-nightly-065 77 5/23/2024
2.3.0-nightly-064 80 5/23/2024
2.3.0-nightly-062 80 5/16/2024
2.2.2-nightly-059 82 4/16/2024
2.2.2-nightly-058 64 4/10/2024
2.2.2-nightly-057 72 4/9/2024
2.2.2-nightly-056 62 4/4/2024
2.2.1 134 3/21/2024
2.2.1-nightly-054 53 3/21/2024
2.2.1-nightly-053 65 3/20/2024
2.2.1-nightly-051 69 3/16/2024
2.2.0 179 12/17/2023
2.2.0-nightly-049 63 12/23/2023
2.2.0-nightly-048 81 12/17/2023
2.2.0-nightly-042 87 9/23/2023
2.2.0-nightly-041 83 9/23/2023
2.2.0-nightly-039 88 9/23/2023
2.1.1 123 9/23/2023
2.1.1-nightly-038 85 9/16/2023
2.1.1-nightly-037 112 8/19/2023
2.1.0 157 8/11/2023
2.1.0-nightly-036 112 8/11/2023
2.1.0-nightly-035 105 5/20/2023
2.1.0-nightly-034 159 1/9/2023
2.1.0-nightly-033 141 12/2/2022
2.0.0 393 11/23/2022
2.0.0-nightly-028 120 11/3/2022
2.0.0-nightly-027 154 10/19/2022
2.0.0-nightly-026 138 10/9/2022
2.0.0-nightly-025 142 10/8/2022
2.0.0-nightly-023 152 9/25/2022
2.0.0-nightly-021 138 9/23/2022
2.0.0-nightly-020 149 9/15/2022
2.0.0-nightly-018 197 9/15/2022
2.0.0-nightly-017 254 8/23/2022
2.0.0-nightly-016 139 8/22/2022
2.0.0-nightly-015 273 7/17/2022
2.0.0-nightly-014 160 7/17/2022
1.1.2 601 4/14/2022
1.1.2-nightly-09 144 6/1/2022
1.1.2-nightly-013 162 7/17/2022
1.1.2-nightly-012 161 7/2/2022
1.1.2-nightly-011 154 6/19/2022
1.1.2-nightly-010 133 6/19/2022
1.1.1-nightly-07 156 4/14/2022
1.1.1-nightly-06 170 4/14/2022
1.1.0 537 4/12/2022
1.0.0 525 4/7/2022
1.0.0-nightly-04 151 4/7/2022
1.0.0-nightly 176 4/7/2022