Skip to main content

Core functionality and utilities for C0deGeek libraries

Total Downloads
775
775
Published
Oct 31, 2024
2y ago

Get Started

dotnet add package C0degeek.Core --version 2.0.5
ProductVersions
.NET
net8.0

README

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.

Downloads by Version

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.