DKDev.Core
1.0.1
dotnet add package DKDev.Core --version 1.0.1
NuGet\Install-Package DKDev.Core -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="DKDev.Core" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DKDev.Core" Version="1.0.1" />
<PackageReference Include="DKDev.Core" />
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 DKDev.Core --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DKDev.Core, 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 DKDev.Core@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=DKDev.Core&version=1.0.1
#tool nuget:?package=DKDev.Core&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DKDev.Core
Lightweight utilities and extensions for .NET applications. Zero dependencies.
Installation
dotnet add package DKDev.Core
Features
- Guard Clauses - Parameter validation helpers
- String Extensions - Common string operations
- URL Validation - HTTP/HTTPS link checking
Usage
Guard Clauses
using DKDev;
public class UserService
{
public void CreateUser(string username, string email)
{
Guard.NotNullOrWhiteSpace(username, nameof(username));
Guard.NotNullOrWhiteSpace(email, nameof(email));
// Your logic here
}
}
String Extensions
using DKDev.Extensions;
string text = " hello world ";
if (text.HasValue())
{
var truncated = text.Truncate(10); // "hello w..."
var withSlash = text.EnsureEndsWith("/"); // " hello world /"
}
URL Validation
using DKDev;
string url = "https://example.com";
if (LinkCheck.IsHttpUrl(url))
{
// Valid HTTP/HTTPS URL
}
API Reference
Guard
NotNull<T>(T value, string paramName)- Throws if nullNotNullOrEmpty(string value, string paramName)- Throws if null/emptyNotNullOrWhiteSpace(string value, string paramName)- Throws if null/empty/whitespaceInRange<T>(T value, string paramName, T min, T max)- Throws if outside range
StringExtensions
IsNullOrEmpty()- Check if null or emptyIsNullOrWhiteSpace()- Check if null, empty, or whitespaceHasValue()- Check if has meaningful valueTruncate(int maxLength, string suffix = "...")- Truncate with suffixEnsureEndsWith(string suffix)- Append suffix if missingEnsureStartsWith(string prefix)- Prepend prefix if missing
LinkCheck
IsHttpUrl(string value)- Validate HTTP/HTTPS URL
License
MIT
Author
Dominik Karczewski
| Product | Versions 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.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.