MikuLib.Utils 10.1.39

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

MikuLib.Utils

A comprehensive utility library for .NET 10 containing essential tools for object mapping, command line argument parsing, and more.

"The world is mine... to code!" - Hatsune Nemas

Powered by CV01 energy since 2007

Features

MikuMapper - Object Mapping

  • Property mapping between objects with automatic type conversion
  • Support for nullable primitives (e.g., int ↔ int?, bool ↔ bool?)
  • Property exclusion during mapping
  • Collection mapping support
  • High-performance reflection-based mapping

CommandLineHelper - Argument Parsing

  • Modern, LINQ-based command line argument parsing
  • Automatic detection via Environment.GetCommandLineArgs()
  • Support for multiple parameter formats: --param value, --param:value, --param=value
  • Multi-value parameter support
  • Environment variable integration
  • Case-insensitive by default

Installation

dotnet add package MikuLib.Utils

Or add to your .csproj:

<PackageReference Include="MikuLib.Utils" Version="10.1.39" />

Quick Start

MikuMapper

using Miku.Utils;

// Map object properties
public class User 
{ 
    public int Id { get; set; }
    public string Name { get; set; }
    public bool? IsActive { get; set; }
}

public class UserDto 
{ 
    public int Id { get; set; }
    public string Name { get; set; }
    public bool IsActive { get; set; }
}

var user = new User { Id = 1, Name = "Miku", IsActive = true };

// Simple mapping
var userDto = MikuMapper.MapProperties<UserDto>(user);

// Exclude properties
var userDto = MikuMapper.MapProperties<UserDto>(user, true, "Password");

// Map collections
var users = new List<User> { user1, user2 };
var userDtos = MikuMapper.MapProperties<UserDto>(users);

CommandLineHelper

using Miku.Utils;

// Automatic detection (uses Environment.GetCommandLineArgs())
if (CommandLineHelper.IsReleaseConfiguration())
{
    // Use release settings
}

var outputPath = CommandLineHelper.GetParameterValue("--output") ?? "./default";

// Modern parsing with ParsedArguments
var parsed = CommandLineHelper.Parse();
var includes = parsed.GetValues("--include"); // Multi-value support
var verbose = parsed.HasParameter("--verbose");

MikuMapper Examples

Basic Mapping

var source = new SourceClass { Id = 1, Name = "Test" };
var target = MikuMapper.MapProperties<TargetClass>(source);

Exclude Properties

var dto = MikuMapper.MapProperties<UserDto>(user, true, "Password", "Salt");

Nullable Primitives

// Automatically handles nullable conversions
// int? -> int, bool -> bool?, etc.
var mapped = MikuMapper.MapProperties<TargetType>(source);

Update Existing Object

var existingUser = dbContext.Users.Find(1);
MikuMapper.MapProperties(updateDto, existingUser, true, "Id");
await dbContext.SaveChangesAsync();

CommandLineHelper Examples

Configuration Detection

var connectionString = CommandLineHelper.IsReleaseConfiguration()
    ? releaseConnectionString
    : debugConnectionString;

Parameter Values

// Single value
var output = CommandLineHelper.GetParameterValue("--output");

// Multiple values
var includes = CommandLineHelper.GetParameterValues("--include");

// With default
var port = CommandLineHelper.GetParameterValue("--port") ?? "8080";

Advanced Parsing

// For: --include *.cs --include *.txt --output ./build --verbose
var parsed = CommandLineHelper.Parse();

// Get all includes
var includes = parsed.GetValues("--include"); // ["*.cs", "*.txt"]

// Get single value
var output = parsed.GetValue("--output"); // "./build"

// Check flag
if (parsed.HasParameter("--verbose"))
{
    // Enable verbose logging
}

Environment Detection

// Checks command line args AND environment variables
if (CommandLineHelper.IsEnvironment("Production"))
{
    // Production configuration
}

var env = CommandLineHelper.GetEnvironment(); // Returns: Development, Production, etc.

API Reference

MikuMapper

Map to new object:

T MapProperties<T>(object source, bool ignoreNull = true, params string[] excludeProperties)

Map collections:

IEnumerable<T> MapProperties<T>(IEnumerable<object> source, bool ignoreNull = true, params string[] excludeProperties)

Map to existing object:

void MapProperties<T>(object source, in T target, bool ignoreNull = true, params string[] excludeProperties)

CommandLineHelper

Configuration checks:

  • IsReleaseConfiguration(args?) - Check for release build
  • IsDebugConfiguration(args?) - Check for debug build

Parameter access:

  • HasParameter(parameter, args?) - Check if parameter exists
  • GetParameterValue(parameter, args?) - Get single value
  • GetParameterValues(parameter, args?) - Get multiple values

Parsing:

  • Parse(args?) - Returns ParsedArguments object
  • ParseArguments(args?) - Returns Dictionary<string, string>
  • ParseArgumentsWithMultipleValues(args?) - Returns Dictionary<string, List<string>>

Environment:

  • IsEnvironment(environment, args?) - Check environment
  • GetEnvironment(args?, defaultEnvironment) - Get environment name

Migration from 10.0.39

♪ Even Miku makes typos sometimes! ♪

The MapPropertys methods have been renamed to MapProperties (correct spelling). The old methods are still available but marked as [Obsolete] and will be removed in version 10.2.39.

Before:

var dto = MikuMapper.MapPropertys<UserDto>(user);  // Typo in name

After:

var dto = MikuMapper.MapProperties<UserDto>(user);  // Correct spelling

Performance

  • MikuMapper: Reflection-based with cached property info for optimal performance
  • CommandLineHelper: LINQ-optimized for efficient parsing
  • Thread-Safe: All operations are thread-safe

Requirements

  • .NET 10.0 or higher
  • C# 14.0

Documentation

Full XML documentation is included for IntelliSense support. See EXAMPLES.md for detailed usage scenarios.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

MIT License - See LICENSE file for details.

Credits

Created by Hatsune Nemas with inspiration from:

  • Hatsune Miku (初音ミク) - CV01, born August 31st, 2007
  • Crypton Future Media
  • The global Vocaloid community

Repository

https://github.com/DjNemas/MikuLib


"The future of voice, the future of code!"

Version: 10.1.39 (Mi-Ku Edition)
Series: CV01 Developer Tools

Product 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 (1)

Showing the top 1 NuGet packages that depend on MikuLib.Utils:

Package Downloads
MikuLib

Main Miku library aggregating all Miku sub-libraries: Core (MikuRgbColor, MikuAnsiCodes, MikuColorHelper), Console (MikuConsole, MikuConsoleAnimation), Utils (MikuMapper, MikuCommandLineHelper), and Logger (with SSE and TrueColor support). The future of voice, the future of code!

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.1.39 465 12/10/2025
10.0.39 514 11/30/2025 10.0.39 is deprecated because it has critical bugs.