SoulNETLib.Common
0.4.6
dotnet add package SoulNETLib.Common --version 0.4.6
NuGet\Install-Package SoulNETLib.Common -Version 0.4.6
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="SoulNETLib.Common" Version="0.4.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SoulNETLib.Common" Version="0.4.6" />
<PackageReference Include="SoulNETLib.Common" />
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 SoulNETLib.Common --version 0.4.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SoulNETLib.Common, 0.4.6"
#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 SoulNETLib.Common@0.4.6
#: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=SoulNETLib.Common&version=0.4.6
#tool nuget:?package=SoulNETLib.Common&version=0.4.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SoulNETLib.Common
A lightweight collection of extension methods for everyday .NET development. Reduces boilerplate across strings, enums, collections, claims, and more.
Installation
dotnet add package SoulNETLib.Common
Requirements: .NET 10+
What's Included
| Category | Key Methods |
|---|---|
| String | OrEmptyIfNull, RemoveWhitespaces, TryRemoveEnd, TryRemoveStart, FirstCharToUpper, GetDigitsInt |
| Enum | GetDescription, GetEnumMember, TryParseEnumMember |
| IEnumerable | OrEmptyIfNull, WhereIf |
| IQueryable | WhereIf (expression tree variant) |
| List | Replace, ReplaceAll |
| Object | HasProperty, CopyPropertyValuesFrom |
| Claims | GetUserId |
| Exception | GetDetailMessage |
Quick Start
Conditional filtering
using SoulNETLib.Common.Extension;
// Apply filter only when a value is provided — works with IQueryable and IEnumerable
var results = query
.WhereIf(!string.IsNullOrEmpty(searchTerm), x => x.Name.Contains(searchTerm))
.WhereIf(categoryId.HasValue, x => x.CategoryId == categoryId);
Enum utilities
using SoulNETLib.Common.Extension;
public enum Status
{
[Description("In Progress")]
InProgress,
[EnumMember(Value = "done")]
Completed
}
var description = Status.InProgress.GetDescription(); // "In Progress"
var member = Status.Completed.GetEnumMember(); // "done"
if ("done".TryParseEnumMember<Status>(out var parsed))
{
// parsed == Status.Completed
}
Null-safe collections
using SoulNETLib.Common.Extension;
IEnumerable<string>? possiblyNull = GetItems();
var safe = possiblyNull.OrEmptyIfNull(); // never null
string? name = GetName();
var safeName = name.OrEmptyIfNull(); // ""
Feedback
Found a bug or have a suggestion? Open an issue on GitHub.
Contributing
Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Please ensure all existing tests pass.
License
This package is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.