NE.Common
1.0.0
dotnet add package NE.Common --version 1.0.0
NuGet\Install-Package NE.Common -Version 1.0.0
<PackageReference Include="NE.Common" Version="1.0.0" />
<PackageVersion Include="NE.Common" Version="1.0.0" />
<PackageReference Include="NE.Common" />
paket add NE.Common --version 1.0.0
#r "nuget: NE.Common, 1.0.0"
#:package NE.Common@1.0.0
#addin nuget:?package=NE.Common&version=1.0.0
#tool nuget:?package=NE.Common&version=1.0.0
NE.Common
General-purpose .NET helpers, kept in one place so that every project does not grow its own copy: extension methods over the types the BCL leaves you to convert by hand, an object-graph serializer that survives cycles and polymorphism, asynchronous loggers, and two small collection types.
Targets net10.0. Its only dependency is Microsoft.Extensions.Logging, and only the logging half uses it.
Install
dotnet add package NE.Common
Released to nuget.org.
Extensions
NE.Common.Extensions — the largest part, and the reason the package exists.
StringExtensions |
TryToInt/ToInt/ToNullableInt and the same trio for every primitive, DateTime, TimeSpan and enums. Parsing a string you did not write, without a try block or an out you do not want. |
CollectionExtensions |
IsNullOrEmpty, WhereNotNull, Groups/Partition, InsertSorted (ascending and descending, with or without a comparer), ForEach, and parallel variants. |
DateTimeExtensions |
Unix seconds and milliseconds both ways, StartOfDay/EndOfDay, month and year boundaries, TrimMilliseconds. |
TimeSpanExtensions |
IsZero, Abs, ToFormat. |
EnumExtensions |
GetName, GetAttribute<T>, GetDescription and GetDescriptionOrName — the [Description] an enum member carries, with its name as the fallback. |
TypeExtensions |
CreateInstance, ResolveType/TryResolveType from a type name. |
ReflectionExtensions |
Read and write a property or a field by name, on an instance or through a Type; enumerate members by the attribute they carry or do not. |
SerializationExtensions |
SerializeGraph/DeserializeGraph over the object-graph serializer, and SerializeJson/DeserializeJson over System.Text.Json. |
using NE.Common.Extensions;
int port = configuration["port"].ToInt(8080); // no parse, no out, no default-by-accident
DateTime? due = row["due"].ToNullableDate("yyyy-MM-dd");
foreach (IReadOnlyList<Order> batch in orders.Partition(100))
await SendAsync(batch);
string label = status.GetDescriptionOrName(); // the [Description], or the member name
Object-graph serialization
NE.Common.Serialization — ObjectGraphSerializer writes an arbitrary object graph and reads it back:
reference cycles are preserved rather than followed forever, and a member declared as a base type comes back
as the derived one it was.
using NE.Common.Extensions;
string data = graph.SerializeGraph(); // base64 by default
Node? restored = data.DeserializeGraph<Node>();
Node copy = graph.SerializeGraphCopy().DeserializeGraph<Node>()!; // a deep copy, cycles and all
ObjectGraphSerializerOptions controls what is walked; a graph it cannot represent fails with
ObjectGraphSerializationException rather than silently dropping part of itself.
Logging
NE.Common.Logging — loggers that do their formatting and their writing off the calling thread, so a log
statement on a hot path costs an enqueue.
builder.Logging.AddAsyncConsoleLogger(LogLevel.Debug);
builder.Logging.AddAsyncFileLogger("logs", LogLevel.Information, retentionDays: 7);
DebugLogger is the one for a test or a scratch program: it writes through System.Diagnostics.Debug and
needs no host.
Files
NE.Common.IO — FileHelper and DirectoryHelper, with FileCopyOptions/DirectoryCopyOptions for the
copy that has to say what it does about overwriting, recursion and filtering.
Types
NE.Common.Types — LimitedStack<T>, which drops its oldest item when it reaches its bound, and
WeakDelegate, which holds a handler without keeping its target alive.
Contributing
This repository is a read-only mirror. Development happens in a private repository and everything here is generated from it, so pull requests are switched off here — anything merged would be erased by the next release.
Issues are open and welcome — bugs, questions and feature requests all belong here.
License
MIT. See LICENSE.
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.Logging (>= 10.0.11)
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.0 | 103 | 8/22/2026 |