Sebschauer.SchauerLib.Extensions 0.0.1-alpha2

This is a prerelease version of Sebschauer.SchauerLib.Extensions.
dotnet add package Sebschauer.SchauerLib.Extensions --version 0.0.1-alpha2
                    
NuGet\Install-Package Sebschauer.SchauerLib.Extensions -Version 0.0.1-alpha2
                    
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="Sebschauer.SchauerLib.Extensions" Version="0.0.1-alpha2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sebschauer.SchauerLib.Extensions" Version="0.0.1-alpha2" />
                    
Directory.Packages.props
<PackageReference Include="Sebschauer.SchauerLib.Extensions" />
                    
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 Sebschauer.SchauerLib.Extensions --version 0.0.1-alpha2
                    
#r "nuget: Sebschauer.SchauerLib.Extensions, 0.0.1-alpha2"
                    
#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 Sebschauer.SchauerLib.Extensions@0.0.1-alpha2
                    
#: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=Sebschauer.SchauerLib.Extensions&version=0.0.1-alpha2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Sebschauer.SchauerLib.Extensions&version=0.0.1-alpha2&prerelease
                    
Install as a Cake Tool

Sebschauer.SchauerLib.Extensions

What it is

This nuget contains a collection of extension methods I found useful over time:

  • T? FirstOf<T>(this IEnumerable list): Returns the first element of the specified type in the list, casted to T
  • bool IsOneOf(this T el, params T[] candidates): Returns whether el is one of the candidates. Makes code more readable:
    • Before: if (new[] { 'w', 'a', 's', 'd' }.Contains(myChar)) { ... }
    • After: if (myChar.IsOneOf('w', 'a', 's', 'd')) { ... }
  • IEnumerable<T> Without<T>(this IEnumerable<T> list, params T[] dels): Removes the given dels from list.
    • Before: var cleaned = list.Where(x => !new List<MyType>{ x1, x2, x3 }.Contains(x));
    • After: var cleaned = list.Without(x1, x2, x3);
  • string? Without(this string? haystack, params string?[] needles): Removes the needles from haystack, preserving null values.
    • Before: var cleaned = rawString.Replace(".", "").Replace(",", "").Replace(" ", "");
    • After: var cleaned = rawString.Without(".", ",", " ");

Resources

Source: https://github.com/sebschauer/schauerlib

Documentation: https://github.com/sebschauer/schauerlib/wiki

Changelog

v0.0.1 - 2025/12/18

First version with FirstOf, IsOneOf and Without.

Copyright Sebastian Schauer 2025

Published under GPL-3.0-or-later

Questions: schauerlib@sebschauer.de

Product Compatible and additional computed target framework versions.
.NET 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.
  • net8.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha2 0 12/19/2025
0.0.1-alpha 0 12/18/2025