SmartExtensionMethods 3.0.3
See the version list below for details.
dotnet add package SmartExtensionMethods --version 3.0.3
NuGet\Install-Package SmartExtensionMethods -Version 3.0.3
<PackageReference Include="SmartExtensionMethods" Version="3.0.3" />
paket add SmartExtensionMethods --version 3.0.3
#r "nuget: SmartExtensionMethods, 3.0.3"
// 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.
Installation
Install-Package SmartExtensionMethods
Currently Available Extension methods (84)
StringExtensions
CaseInsensitiveContains
Checks if string is contained using case insensitive searchCaseInsensitiveCompare
Compares two string using insensitive caseToValueOrDefault
Returns value or if null, returns provided default valueIsNullOrEmpty
Checks if string is null or emptyIsNullOrWhitespace
Checks if string is null or white spaceRemoveSpaces
Removes all spaces from stringTryToInt16
Casts string to short using the try patternTryToInt32
Casts string to int using the try patternTryToInt64
Casts string to long using the try patternTryToDate
Casts string to date using the try patternTryToDecimal
Casts string to decimal using the try patternTryToDouble
Casts string to double using the try patternReverse
Reverses the stringIsEmail
Checks if string is an email stringExtractEmail
Returns a new string containing an email from the original string. If no email found returns String.emptyIsPhone
Checks if string resembles a phone numberIsPalindrome
Checks if string is a palindromeContainsAll
Check whether the specified string contains an array of strings for each.DeserializeXml<T>
Deserializes string XML to type <T>.Nl2Br
Converts Windows and Linux new line characters to HTML break charactersEqualsAny
Check that the given string is in a list of potential matches.Join
Joins a list of strings with the provided separatorJoinWithComma
Joins a list of strings with ", "JoinWithSpace
Joins a list of strings with a single spaceGetEnumValue
Get Enum value (case inssensitive) or return provided default if not foundToCamelCase
Converts a string with spaces to a string with camelCase representation
DoubleExtensions
IsNaN
IsInfinity
GetPercentage
Returns a value representing the percentage requestedPow
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 fasterKB
Returns value in KilobytesMB
Returns value in MegabytesGB
Returns value in GigabytesTB
Returns value in Terabytes
FloatExtensions
IsNaN
IsInfinity
GetPercentage
Returns a value representing the percentage requestedPow
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 fasterKB
Returns value in KilobytesMB
Returns value in MegabytesGB
Returns value in GigabytesTB
Returns value in Terabytes
IntExtensions
GetPercentage
Returns a value representing the percentage requestedPow
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 fasterKB
Returns value in KilobytesMB
Returns value in MegabytesGB
Returns value in GigabytesTB
Returns value in TerabytesIsPrime
Checks if number is Prime
ShortExtensions
GetPercentage
Returns a value representing the percentage requestedPow
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 fasterKB
Returns value in KilobytesMB
Returns value in MegabytesGB
Returns value in GigabytesTB
Returns value in TerabytesIsPrime
Checks if number is Prime
DateTimeExtensions
FirstDayOfMonth
Get first day of the monthFirstDayOfMonth
Get first specific day of the monthNextSpecificDay
Next specific dayLastDayOfMonth
Get last day of the monthLastDayOfMonth
Get last specific day of the monthSetTime
Get DateTime with specific time. Overloads for minute accuracy, second accuracy and milisecond accuracyGetNoon
Gets a DateTime representing noon on the current dateGetMidnight
Gets a DateTime representing midnight on the current dateAge
Gets the age of a personToUnixEpoch
Converts UTC time to Unix timeFromUnixEpoch
Converts Unix time to UTC timeFirstBusinessDayOfMonth
Gets a DateTime representing the first business day of the month of the provided DateTimeFirstBusinessDayOfMonth
Gets a DateTime representing the first business day of the month of the provided DateTime that is not part of a given holidays listLastBusinessDayOfMonth
Gets a DateTime representing the last business day of the month of the provided DateTimeLastBusinessDayOfMonth
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
Sum
Introduced sum method for LINQ usage for TimeSpansIsNullOrEmpty
Checks if Enumerable is null or emptyForeach
Executes provided action on each item of the EnumerableStandardDeviation <int>
Performs Standard Deviation on the entire datasetStandardDeviationPopulation <int>
Performs Standard Deviation on the entire dataset (Population)ToHashSet<T>
Takes any IEnumerable<T> and converts it to a HashSet<T>
XmlDocumentExtensions
AppendXml
Append one or multiple XML documents to the current XML documentDeserializeXml<T>
Deserializes XMLDocument to type <T>.
TimeSpanExtensions
MilliSeconds
Get TimeSpan.FromMilliSeconds() from int and doubleSeconds
Get TimeSpan.FromSeconds() from int and doubleMinutes
Get TimeSpan.FromMinutes() from int and doubleHours
Get TimeSpan.FromHours() from int and doubleDays
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 | Versions 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. |
-
.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.
Version | Downloads | Last updated | |
---|---|---|---|
3.0.6 | 2,286 | 6/15/2023 | |
3.0.5 | 153 | 6/13/2023 | |
3.0.4 | 159 | 6/13/2023 | |
3.0.3 | 314 | 5/5/2023 | |
3.0.2 | 7,230 | 12/2/2021 | |
3.0.0 | 30,021 | 9/8/2020 | |
2.4.2 | 539 | 9/3/2020 | |
2.4.1 | 619 | 6/21/2020 | |
2.3.6 | 586 | 6/17/2020 | |
2.3.5 | 557 | 6/11/2020 | |
2.3.4 | 532 | 6/11/2020 | |
2.2.4 | 524 | 6/11/2020 | |
2.1.1 | 864 | 6/6/2020 | |
2.1.0 | 697 | 6/6/2020 | |
1.3.1 | 864 | 6/4/2020 | |
1.2.2 | 824 | 6/3/2020 | |
1.2.1 | 693 | 6/3/2020 | |
1.1.0 | 693 | 6/3/2020 | |
1.0.0 | 706 | 5/31/2020 | |
0.5.0 | 751 | 5/29/2020 | |
0.4.1 | 739 | 5/29/2020 | |
0.4.0 | 920 | 5/29/2020 | |
0.3.0 | 734 | 5/29/2020 | |
0.2.0 | 701 | 5/28/2020 | |
0.1.0 | 680 | 5/28/2020 |