SmartExtensionMethods 3.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartExtensionMethods --version 3.0.3                
NuGet\Install-Package SmartExtensionMethods -Version 3.0.3                
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="SmartExtensionMethods" Version="3.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SmartExtensionMethods --version 3.0.3                
#r "nuget: SmartExtensionMethods, 3.0.3"                
#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.
// Install SmartExtensionMethods as a Cake Addin
#addin nuget:?package=SmartExtensionMethods&version=3.0.3

// Install SmartExtensionMethods as a Cake Tool
#tool nuget:?package=SmartExtensionMethods&version=3.0.3                

SmartExtensions

A big list of commonly used methods and extension methods when using C# built-in types. Methods and extensions all of us write often enough to render grouping them in a nuget package useful.

.NET Core Build and Run Unit Tests

Installation

Install-Package SmartExtensionMethods

Currently Available Extension methods (84)

StringExtensions

  1. CaseInsensitiveContains Checks if string is contained using case insensitive search
  2. CaseInsensitiveCompare Compares two string using insensitive case
  3. ToValueOrDefault Returns value or if null, returns provided default value
  4. IsNullOrEmpty Checks if string is null or empty
  5. IsNullOrWhitespace Checks if string is null or white space
  6. RemoveSpaces Removes all spaces from string
  7. TryToInt16 Casts string to short using the try pattern
  8. TryToInt32 Casts string to int using the try pattern
  9. TryToInt64 Casts string to long using the try pattern
  10. TryToDate Casts string to date using the try pattern
  11. TryToDecimal Casts string to decimal using the try pattern
  12. TryToDouble Casts string to double using the try pattern
  13. Reverse Reverses the string
  14. IsEmail Checks if string is an email string
  15. ExtractEmail Returns a new string containing an email from the original string. If no email found returns String.empty
  16. IsPhone Checks if string resembles a phone number
  17. IsPalindrome Checks if string is a palindrome
  18. ContainsAll Check whether the specified string contains an array of strings for each.
  19. DeserializeXml<T> Deserializes string XML to type <T>.
  20. Nl2Br Converts Windows and Linux new line characters to HTML break characters
  21. EqualsAny Check that the given string is in a list of potential matches.
  22. Join Joins a list of strings with the provided separator
  23. JoinWithComma Joins a list of strings with ", "
  24. JoinWithSpace Joins a list of strings with a single space
  25. GetEnumValue Get Enum value (case inssensitive) or return provided default if not found
  26. ToCamelCase Converts a string with spaces to a string with camelCase representation

DoubleExtensions

  1. IsNaN
  2. IsInfinity
  3. GetPercentage Returns a value representing the percentage requested
  4. Pow Extension method for performing Pow arithmetic expression when Power is a positive non-zero, non floating point number by using loop implementation as it is benchmarked to be faster
  5. KB Returns value in Kilobytes
  6. MB Returns value in Megabytes
  7. GB Returns value in Gigabytes
  8. TB Returns value in Terabytes

FloatExtensions

  1. IsNaN
  2. IsInfinity
  3. GetPercentage Returns a value representing the percentage requested
  4. Pow Extension method for performing Pow arithmetic expression when Power is a positive non-zero, non floating point number by using loop implementation as it is benchmarked to be faster
  5. KB Returns value in Kilobytes
  6. MB Returns value in Megabytes
  7. GB Returns value in Gigabytes
  8. TB Returns value in Terabytes

IntExtensions

  1. GetPercentage Returns a value representing the percentage requested
  2. Pow Extension method for performing Pow arithmetic expression when Power is a positive non-zero, non floating point number by using loop implementation as it is benchmarked to be faster
  3. KB Returns value in Kilobytes
  4. MB Returns value in Megabytes
  5. GB Returns value in Gigabytes
  6. TB Returns value in Terabytes
  7. IsPrime Checks if number is Prime

ShortExtensions

  1. GetPercentage Returns a value representing the percentage requested
  2. Pow Extension method for performing Pow arithmetic expression when Power is a positive non-zero, non floating point number by using loop implementation as it is benchmarked to be faster
  3. KB Returns value in Kilobytes
  4. MB Returns value in Megabytes
  5. GB Returns value in Gigabytes
  6. TB Returns value in Terabytes
  7. IsPrime Checks if number is Prime

DateTimeExtensions

  1. FirstDayOfMonth Get first day of the month
  2. FirstDayOfMonth Get first specific day of the month
  3. NextSpecificDay Next specific day
  4. LastDayOfMonth Get last day of the month
  5. LastDayOfMonth Get last specific day of the month
  6. SetTime Get DateTime with specific time. Overloads for minute accuracy, second accuracy and milisecond accuracy
  7. GetNoon Gets a DateTime representing noon on the current date
  8. GetMidnight Gets a DateTime representing midnight on the current date
  9. Age Gets the age of a person
  10. ToUnixEpoch Converts UTC time to Unix time
  11. FromUnixEpoch Converts Unix time to UTC time
  12. FirstBusinessDayOfMonth Gets a DateTime representing the first business day of the month of the provided DateTime
  13. FirstBusinessDayOfMonth Gets a DateTime representing the first business day of the month of the provided DateTime that is not part of a given holidays list
  14. LastBusinessDayOfMonth Gets a DateTime representing the last business day of the month of the provided DateTime
  15. LastBusinessDayOfMonth Gets a DateTime representing the last business day of the month of the provided DateTime that is not part of a given holidays list

IEnumerableExtensions

  1. Sum Introduced sum method for LINQ usage for TimeSpans
  2. IsNullOrEmpty Checks if Enumerable is null or empty
  3. Foreach Executes provided action on each item of the Enumerable
  4. StandardDeviation <int> Performs Standard Deviation on the entire dataset
  5. StandardDeviationPopulation <int> Performs Standard Deviation on the entire dataset (Population)
  6. ToHashSet<T> Takes any IEnumerable<T> and converts it to a HashSet<T>

XmlDocumentExtensions

  1. AppendXml Append one or multiple XML documents to the current XML document
  2. DeserializeXml<T> Deserializes XMLDocument to type <T>.

TimeSpanExtensions

  1. MilliSeconds Get TimeSpan.FromMilliSeconds() from int and double
  2. Seconds Get TimeSpan.FromSeconds() from int and double
  3. Minutes Get TimeSpan.FromMinutes() from int and double
  4. Hours Get TimeSpan.FromHours() from int and double
  5. Days Get TimeSpan.FromDays() from int and double

Contributing

Contributions are always welcome! Please feel free to submit pull requests and to open issues. I prefer to have tests on all public methods if possible and where ever else makes sense.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SmartExtensionMethods:

Package Downloads
ExtendedGeoCoordinate

A port of GeoCoordinate class to .Net Standard along with some extended functionality

NmeaParser

An Nmea GPS line parser

GitHub repositories

This package is not used by any popular GitHub repositories.