C0degeek.Core 2.0.4

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

// Install C0degeek.Core as a Cake Tool
#tool nuget:?package=C0degeek.Core&version=2.0.4                

C0deGeek Libraries

A collection of .NET utility libraries providing core functionality and extensions for modern C# development.

Packages

This solution produces two NuGet packages:

C0deGeek.Core (v1.0.1)

Core utilities and base functionality including:

  • Type-safe enum implementation
  • DateTime utilities with testing support
  • Code/Name domain models
  • Custom validation attributes

C0deGeek.Extensions (v1.0.1)

A comprehensive collection of extension methods enhancing basic .NET types:

  • Collection extensions (safe removal operations)
  • Decimal extensions (normalization and formatting)
  • Enum extensions (description and member value handling)
  • String extensions (enhanced null checks)
  • Type extensions (reflection helpers)

Features

DateTime Utilities

  • Mockable DateTime for testing
  • Time zone handling
  • Age calculation utilities

Type-Safe Enums

  • Strongly-typed enum pattern implementation
  • Code/Name/Description support
  • Validation and comparison capabilities

Validation Attributes

  • Enum validation (codes, descriptions, member values)
  • Integration with System.ComponentModel.DataAnnotations

Extension Methods

  • Enhanced LINQ-style operations
  • Formatting and conversion utilities
  • Reflection helpers

Installation

Add the NuGet packages to your project:

dotnet add package C0deGeek.Core
dotnet add package C0deGeek.Extensions

Usage Examples

DateTime Utilities

// Set a fixed time for testing
GeekDateTime.SetUtcDateTime(new DateTime(2024, 1, 1));

// Get current time (mockable)
var now = GeekDateTime.UtcNow;

// Calculate years passed
var years = GeekDateTime.YearsPassed(startDate, endDate);

Type-Safe Enums

public class Status : TypeSafeEnumBase<Status>
{
    public static readonly Status Active = new("ACTIVE", "Active");
    public static readonly Status Inactive = new("INACTIVE", "Inactive");

    private Status(string code, string name) : base(code, name) { }
}

Extensions

// Collection extensions
collection.RemoveAll(x => x.IsObsolete);

// Decimal formatting
decimal value = 123.4500m;
string normalized = value.ToNormalizedString(); // "123.45"

// Enhanced null checks
if (str.IsNullOrEmptyOrWhiteSpace()) { }

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

License: MIT
This project is licensed under the MIT License - see the LICENSE.md file for details.

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. 
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
2.0.5 20 10/31/2024
2.0.4 21 10/31/2024
1.0.0 184 4/4/2023