IntelliDataSort Documentation
v1.0.0Introduction
✅ IntelliDataSort: Intelligent, Secure, Type-Aware Sorting for Real-World Data
“Sort like a human — but with enterprise-grade validation and security.”
IntelliDataSort is a high-fidelity sorting
library for .NET that intelligently sorts
mixed-type data (numbers, dates, versions, currencies, IP addresses, file sizes, etc.) in a
way that matches human expectations —
without the fragility, security risks, or ambiguity of naive string sorting.
- ✅ Detects and validates data types explicitly (no guesswork)
- ✅ Prevents injection attacks & malformed input crashes
- ✅ Respects cultural nuances (e.g.,
1,234.56vs1.234,56) - ✅ Preserves stability and null handling
- ✅ Returns parsed values (e.g.,
Version → { Major=2, Minor=5 })
🔍 Why It’s Better Than Generic Sort Helpers
| Feature | IntelliDataSort | Generic Helpers |
|---|---|---|
| Type-aware sorting | ✅ Explicit
ColumnType |
❌ Heuristic-only |
| Security hardening | ✅ Rejects
"1e999", Roman numerals |
❌ Vulnerable to DoS |
| Currency/Version parsing | ✅ Full ISO 4217 + SemVer 2.0 | ❌ Limited/none |
| File size & IP sorting | ✅ Parses
1.5KB, 192.168.1.1 |
❌ String sort fails |
| Input validation & injection protection | ✅ Blocks malformed/malicious inputs | ❌ No validation layer |
| Stable output | ✅ Preserves order for equal keys | ⚠️ Often unstable |
💡 Perfect For:
- Data grids & reporting tools (Blazor, WinForms, WPF)
- CSV/Excel import pipelines
- Log analyzers, configuration managers
- Any mixed-data scenario (
"file10.txt","$1,250.50","v2.1.0-beta")
var sorter = new HumanSort();
var sorted = sorter.Sort(
new[] { "01/15/2024", "2024-02-01", "15-Mar-2024", "03.04.2024", "May 5, 2024" },
ColumnType.DateTime,
ascending: true
);
// → ["01/15/2024", "03.04.2024", "2024-02-01", "15-Mar-2024", "May 5, 2024"]
🛡️ Built for production: Zero dependencies, .NET 6+ compatible and rigorously tested against edge cases.
Installation
IntelliDataSort is available as a NuGet package. Install version 1.0.0:
.NET CLI
dotnet add package IntelliDataSort --version 1.0.0
Nuget Package Manager Console
Install-Package IntelliDataSort -Version 1.0.0
PackageReference (csproj)
<PackageReference Include="IntelliDataSort" Version="1.0.0" />
Basic Usage
💰 Currency Sorting
var sorter = new HumanSort();
var currencies = new[] { "€75.25", "$100.50", "£200.00", "¥10000" };
var sorted = sorter.Sort(currencies, ColumnType.Currency, ascending: true);
// → ["€75.25", "$100.50", "£200.00", "¥10000"]
✅ What it does:
- Parses and validates standard currency formats (USD, EUR, GBP, JPY, etc.)
- Sorts **numerically within the same currency**
- For mixed currencies, maintains stable order (no cross-currency conversion)
- Rejects malformed inputs like
"USD$100"or"100 dollars"
📊 Percentage Sorting
var sorter = new HumanSort();
var percentages = new[] { "50%", "100%", "-25%", "(10%)" };
var sorted = sorter.Sort(percentages, ColumnType.Percentage, ascending: true);
// → ["(10%)", "-25%", "50%", "100%"]
// Note: "(10%)" = -10% (parentheses = negative)
✅ What it does:
- Handles explicit signs (
-25%) and accounting notation ((10%)=-10%) - Sorts numerically:
-25% < -10% < 50% < 100% - Blocks invalid formats like
"50 percent"or"100/2%"
📁 File Size Sorting
var sorter = new HumanSort();
var filesizes = new[] { "1.5KB", "10.2GiB", "500B", "2MB" };
var sorted = sorter.Sort(filesizes, ColumnType.FileSize, ascending: true);
// → ["500B", "1.5KB", "2MB", "10.2GiB"]
✅ What it does:
- Converts mixed units (B, KB, MB, GiB) to bytes for accurate comparison
- Distinguishes decimal (KB = 1000) vs. binary (KiB = 1024) units
- Rejects ambiguous inputs like
"10MB/s"or"100 GB"(space before unit)
🔒 Security Note
All examples automatically reject malicious inputs like:
- Scientific notation abuse (
"1e999") - Rejects command injection attempts like
"1.0.0+$(rm -rf /)" - Invalid currency symbols (
"100 ₿") - Blocks homoglyph attack, sql injection attack
Perfect for enterprise data grids, log analyzers, and financial applications!
Number
Numeric-aware sorting with hex/binary/octal support.
DateTime
Culture-aware date/time comparison and sorting.
NaturalString
Human-readable sort: "file2.txt" < "file10.txt" .
PlainString
Lexicographic (ASCII-baseline) sorting.
IpAddress
IPv4 aware sorting.
Percentage
Sort by numeric value (e.g., "50%" < "100%" ).
FileSize
Sort by byte size: "1KB" < "1MB" .
Version
SemVer-compatible version string sorting.
Currency
Parse and sort monetary values (e.g., "$10" < "$100" ).