I am delighted to announce the release of Spargine 10 (v2026.10.4.1) on April 1st, 2026. Spargine, my open-source project, now offers NuGet packages for .NET 10. These enhancements have been integrated across all my projects. I encourage you to explore these updates and share any feedback or suggestions for further improvements.
This version supports .NET 10, introduces new types, methods, benchmarks, and comprehensive unit tests, all aimed at improving Spargine’s performance and reliability! Notably, this release includes speed enhancements informed by benchmark tests outlined in the 5th edition of Rock Your Code: Code & App Performance for Microsoft .NET, available on Amazon.
GitHub: https://github.com/RealDotNetDave/dotNetTips.Spargine.10/releases
NuGet: http://bit.ly/dotNetDaveNuGet
You can access all the performance data for these assemblies on GitHub. I continually seek assistance with these projects. If you are interested in contributing, please don’t hesitate to contact me via email at dotnetdave@live.com. Your support and collaboration are highly appreciated!
New Classes and Methods
Below are the new classes and methods added to this version of Spargine.
dotNetTips.Spargine.Core
| Type | Method | Description |
|---|---|---|
| App | ClearAppState() | Clears all entries from the application state dictionary. |
| App | RemoveAppState() | Removes a value from the application state dictionary using the specified key. |
| Clock | CurrentDayOfWeek | Gets the current day of the week (local time). |
| Clock | CurrentDayOfYear | Gets the current day of the year (local time), from 1 to 366. |
| Clock | CurrentQuarter | Gets the current quarter of the year (local time), from 1 to 4. |
| Clock | CurrentUtcDayOfWeek | Gets the current day of the week (UTC). |
| Clock | CurrentUtcQuarter | Gets the current quarter of the year (UTC), from 1 to 4. |
| Clock | DaysInMonth() | Gets the number of days in the specified month of the specified year. |
| Clock | DaysRemainingInMonth | Gets the number of days remaining in the current month (local time). |
| Clock | DaysRemainingInYear | Gets the number of days remaining in the current year (local time). |
| Clock | FirstDayOfCurrentMonth | Gets the first day of the current month (local time). |
| Clock | IsCurrentUtcYearLeapYear | Gets a value indicating whether the current UTC year is a leap year. |
| Clock | IsCurrentYearLeapYear | Gets a value indicating whether the current local year is a leap year. |
| Clock | IsWeekday | Gets a value indicating whether today is a weekday (Monday through Friday) in local time. |
| Clock | IsWeekend | Gets a value indicating whether today is a weekend (Saturday or Sunday) in local time. |
| Clock | LastDayOfCurrentMonth | Gets the last day of the current month (local time). |
| Clock | LocalUtcOffset | Gets the local time zone’s current UTC offset. |
| Clock | Today | Gets midnight (start of day) for today in local time. |
| Clock | TodayMidnight | Gets midnight (start of day) for today in local time. |
| Clock | UnixTimestamp | Gets the Unix timestamp (seconds since January 1, 1970 UTC). |
| Clock | UnixTimestampMilliseconds | Gets the Unix timestamp in milliseconds (milliseconds since January 1, 1970 UTC). |
| ComputerInfo | ToJson() | Converts the current instance of ComputerInfo to a JSON string. |
| ElapsedEventArgs | Elapsed | Gets the elapsed time reported by this event. |
| EncryptionHelper | AesGcmEncrypt() | Encrypts a string using AES-GCM (Galois/Counter Mode) authenticated encryption. |
| Enumeration | TryFromDisplayName<T>() | Attempts to retrieve an enumeration instance of type T that matches the specified display name. |
| Enumeration | TryFromValue<T>() | Attempts to retrieve an enumeration instance of type T that matches the specified integer value. |
| EnumHelper | TryParse<T>() | Attempts to parse the specified name into an enum value of type T. |
| NetworkHelper | GetDnsServerAddresses() | Gets the DNS server addresses configured for the active network interfaces. |
| NetworkHelper | GetGatewayAddresses() | Gets the gateway addresses configured for the active network interfaces. |
| NetworkHelper | GetHostName() | Gets the hostname of the local computer. |
| NetworkHelper | GetLocalIPAddresses() | Gets the local IP addresses for the computer. |
| NetworkHelper | GetMacAddresses() | Gets the MAC (physical) address of the active network interface. |
| NetworkHelper | GetNetworkSpeeds() | Gets the network speed (bandwidth) of active network interfaces in bits per second. |
| NetworkHelper | GetNetworkStatistics() | Gets network statistics for the specified network interface type. |
| NetworkHelper | GetPrimaryNetworkInterface() | Gets detailed information about the primary network interface. |
| NetworkHelper | IsConnectedToEthernet() | Checks if the computer is connected to an Ethernet network. |
| NetworkHelper | IsConnectedToNetwork() | Checks if the computer is connected to any network. |
| NetworkHelper | IsConnectedToWiFi() | Checks if the computer is connected to a Wi-Fi network. |
| NetworkHelper | IsIPv6Supported() | Checks if the specified network interface supports IPv6. |
| PerformanceStopwatch | GetElapsedTime() | Calculates the elapsed time since a starting high-resolution timestamp using the system performance counter. |
| PerformanceStopwatch | GetTimeStamp() | Gets the current high-resolution timestamp from the system’s performance counter. |
| SimpleResult | AddMessage() | Adds a message to the collection of messages associated with this result. |
dotNetTips.Spargine.Extentions
| Type | Method | Description |
|---|---|---|
| CharacterExtensions | GetDigitValue() | Gets the numeric value of the character if it is a digit (0-9). |
| CharacterExtensions | IsAsciiControl | Gets a value indicating whether the specified character is an ASCII control character (0-31 or 127). |
| CharacterExtensions | IsAsciiPunctuation | Gets a value indicating whether the specified character is an ASCII punctuation character. |
| CharacterExtensions | IsAsciiUpper | Gets a value indicating whether the specified character is an ASCII uppercase letter (A-Z). |
| CharacterExtensions | IsAsciiWhitespace | Gets a value indicating whether the specified character is an ASCII whitespace character. |
| CharacterExtensions | IsHexDigit | Gets a value indicating whether the specified character is a valid hexadecimal digit (0-9, A-F, a-f). |
| CharacterExtensions | IsNewLine | Gets a value indicating whether the specified character is a newline character (CR or LF). |
| CharacterExtensions | IsUnicodeDigit | Gets a value indicating whether the specified character is a Unicode digit. |
| CharacterExtensions | ToAsciiLower() | Converts the character to lowercase using ASCII rules (fast path for a-z range). |
| CharacterExtensions | ToAsciiUpper() | Gets the uppercase equivalent of the character using ASCII rules (fast path for A-Z range). |
| EnumerableExtensions | FastContains() | Performs a membership check using the most efficient strategy available for the underlying sequence. |
| EnumExtensions | FlagCount | Gets the count of flags set in a flag enum. |
| EnumExtensions | GetAttribute() | Gets the custom attribute of type TAttributeapplied to the enum value. |
| EnumExtensions | GetDisplayName() | Gets the display name from the DisplayAttribute if present; otherwise returns the enum’s name. |
| EnumExtensions | GetSetFlags() | Gets the individual flag values that are set in a flag enum. |
| EnumExtensions | Next() | Gets the next enum value in sequence, or the first value if at the end. |
| EnumExtensions | Previous() | Gets the previous enum value in sequence, or the last value if at the beginning. |
| EnumExtensions | ToInt32() | Gets the 32-bit integer value of the enum. |
| EnumExtensions | ToInt64() | Gets the 64-bit integer value of the enum. |
| ReadOnlyCollectionExtensions | GetValueOrDefault() | Gets the element at the specified index, or the default value if the index is out of range. |
| ReadOnlyCollectionExtensions | TryGetValue() | Attempts to get the element at the specified index. |
| SortedSet | ToImmutable() | Converts a SortedSet to an ImmutableSortedSet. |
dotNetTips.Spargine.Tester
| Type | Method | Description |
|---|---|---|
| UnitTester | CleanupOutputDirectory() | Deletes all files matching the specified search pattern from the output directory. |
| UnitTester | MeasureAction() & MeasureActionAsync() | Executes the specified action and returns the elapsed time, optionally printing the result to the debug output. |
| UnitTester | SaveAsJsonToFile() | Serializes the specified object to JSON and saves it to a file in the output directory. |
| UnitTester | SaveToFileAsync() | Asynchronously saves the specified input string to a file in the output directory. |
Performance Enhancements: Significant Speed Improvements Across Methods
With every new release of Spargine, I continue to refine performance — and the .NET 10 version delivers substantial speed gains across many methods. Some improvements came because of careful tuning and benchmarking (sometimes with help from Copilot — with mixed results).
Here are the most notable speed increases:
- App.ProcessPath(): 2x faster.
- CollectionExtensions.AddRange(): 1.49x faster.
- EnumerableExtensions.Create(): 86x faster with decreased allocations by 6x.
- EnumerableExtensions.ToBlockingCollection(): 4.66x faster and decreased allocations by 3x.
- ListExtensions.ToObservableCollection(): 28x faster and decreased allocations by 14x.
- ListExtensions.ToReadOnlyObservableCollection(): 28x faster and decreased allocations by 10x.
- LoggingHelper.LogApplicationInformation(): 775x faster.
- PasswordGenerator.GeneratePassword(): 1.84x faster.
- StringExtensions.CalculateTotalLength(): 3.3x faster with no allocations.
- StringExtensions.HasValue() – String: 9.74x faster.
- StringExtensions.HasValue() – using length: 1.64x faster.
- StringExtensions.HasValue(): 2,535x faster.
- StringExtensions.HasWhitespace(): 2.74x faster.
- TypeHelper.GetAllGenericMethods(): 23.9x faster and decreased allocations by 15.8x.
- TypeHelper.GetAllPublicMethods(): 8.08x faster and decreased allocations by 15.13x.
- TypeHelper.GetAllStaticMethods(): 16.28x faster and decreased allocations by 9.4x.
- TypeHelper.GetAttribute() – FieldInfo: 2.6x faster.
Summary
I’m confident these new and enhanced Spargine features will significantly improve your projects by boosting both performance and reliability. Detailed benchmark results are available on GitHub for those who want to dig deeper.
As always, open-source thrives on community involvement. If you find these updates helpful — or have ideas for future improvements — I encourage you to jump in. Whether through pull requests, issue reports, or feature suggestions, your contributions are invaluable.
Together, we can continue to make Spargine a robust and indispensable tool for the .NET community. Your feedback is always welcome, so please share your thoughts in the comments.
If my work has helped you write faster, cleaner, rock-solid .NET code, I’d love your support through GitHub Sponsors. Your sponsorship helps fuel new features, benchmarks, tools, and learning resources for the entire community.
Join the crew here: https://github.com/sponsors/RealDotNetDave — and thanks for helping keep the code loud and fast!
Thank you for your support — and keep coding faster, smarter, and better!
Pick up any books by David McCarter by going to Amazon.com: http://bit.ly/RockYourCodeBooks
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
DonateDonate monthlyDonate yearlyIf you liked this article, please buy David a cup of Coffee by going here: https://www.buymeacoffee.com/dotnetdave
© The information in this article is copywritten and cannot be preproduced in any way without express permission from David McCarter.
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.
