ProfMinecraftDev.CSharpEx 1.0.1

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

🚀 CSharpEx

El Toolkit de extensiones definitivo para .NET. Una librería diseñada para potenciar el desarrollo multiplataforma, simplificando tareas complejas de sistema y ofreciendo azúcar sintáctico para el día a día.

🌟 Características Destacadas

🛡️ Gestión de Procesos Avanzada (ProcessExtensions)

Control total sobre los subprocesos de tu aplicación.

  • Job Objects (Kill-on-Close): Asegura que los procesos hijos mueran si tu app principal se cierra.
  • RAM Limiting: Restringe el Working Set (RAM física) de cualquier proceso en Windows y otras plataformas.
  • Static Factories: Métodos estáticos para crear e iniciar procesos configurados en una sola línea.

🧪 Utilidades de Colecciones (EnumerableExtensions)

Operaciones fluidas para tus listas y enumerables.

  • PickRandom: Selecciona un elemento al azar de cualquier colección.
  • Safe Checks: Verifica si una lista es nula o está vacía con IsNullOrEmpty().
  • AddIfMissing: Añade elementos a una lista evitando duplicados automáticamente.

🛠️ Herramientas de Sistema y Datos

  • Formato de Archivos: Convierte bytes a strings legibles (KB, MB, GB... hasta Exabytes).
  • Guard Pattern: Validaciones rápidas como IsBlank, HasContent y Clamp para números.
  • Fluent Casting: Casteo de objetos limpio con .To<T>() y .As<T>().
  • Typed Events: Delegado TypedEventHandler<TSender, TArgs> para eventos fuertemente tipados.

💻 Ejemplos de Código

Iniciar un Servidor con Protección y Límite de RAM

Ideal para herramientas de administración de servidores (Minecraft, bases de datos, etc.).

using CSharpEx;

// Inicia un proceso que se cerrará automáticamente al cerrar tu app
var server = ProcessExtensions.StartAsJob("java.exe", "-Xmx2G -jar server.jar");

// O inicia un proceso limitando su consumo de RAM física a 1GB
bool ok = myProcess.StartWithRamLimited(1024);

Manipulación de Datos

// Obtener un jugador aleatorio de una lista
var randomPlayer = players.PickRandom();

// Validar que un valor de configuración esté dentro de un rango
int tickRate = configValue.Clamp(1, 20);

// Mostrar el tamaño de un mundo de forma legible
long folderSize = 1536782336;
Console.WriteLine(folderSize.ToSizeString()); // Output: "1.43 GB"


📦 Estructura del Proyecto

  • CSharpEx: Extensiones de tipos base (Process, String, Object, Number).
  • CSharpEx.Foundation: Tipos base y delegados como TypedEventHandler.
  • CSharpEx.Versioning: Polyfills para compatibilidad de atributos de plataforma en versiones antiguas de .NET.

🏗️ Compatibilidad

Gracias a nuestro sistema de preprocesamiento, la librería funciona perfectamente en:

  • .NET 3.5 (Legacy Support)
  • .NET Framework 4.6.2 / 4.8
  • .NET 6.0 / 8.0 (Modern .NET)

Creado por Prof Minecraft. Licencia MIT.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Framework net35 is compatible.  net40 was computed.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 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
1.0.1 95 2/14/2026
1.0.0 101 2/13/2026

Initial release with Process, String, Number and Object extensions.