Extension.Methods
0.1.0
See the version list below for details.
dotnet add package Extension.Methods --version 0.1.0
NuGet\Install-Package Extension.Methods -Version 0.1.0
<PackageReference Include="Extension.Methods" Version="0.1.0" />
paket add Extension.Methods --version 0.1.0
#r "nuget: Extension.Methods, 0.1.0"
// Install Extension.Methods as a Cake Addin #addin nuget:?package=Extension.Methods&version=0.1.0 // Install Extension.Methods as a Cake Tool #tool nuget:?package=Extension.Methods&version=0.1.0
Extension.Methods
Extension.Methods is a C# library built on top of .Net Standard 2.0. This library contains most of the extension methods that you would use in everyday life. We are committed to adding new methods.
The reason why we started this project is very simple. Mostly to automate a redundant process. Each time we used to start a new project, we had to copy and paste these lines of codes to our project. Though most of the extension methods are available in the internet, they are not present under a single library. So we added everything to one place and created a package out of it. Adding this package to your existing/new project is as easy as adding any other NuGet package.
Installation
The library is hosted on NuGet. You can install the same to your project using both Package Manager and .Net CLI.
Installing Extension.Methods using NuGet Package Manager Console
PM>Install-Package Extension.Methods
Installing Extension.Methods using .Net CLI
>dotnet add package Extension.Methods
This will install the packages and its dependencies to your project and you can start using the methods just by importing the Extension.Methods namespace.
Example
using System;
using System.Collections.Generic;
using Extension.Methods; // This is important
namespace YourProject.TestApp
{
class Program
{
static void Main(string[] args)
{
var l = new List<int>() { 1, 2, 4, 8, 5, 3 };
l.Sort();
l.InsertSorted(0); // You can use all the available extension methods like this.
Console.ReadKey();
}
}
}
API References
The project contains extension methods for the followings.
- StringExtensions
- NumberExtensions
- DateTimeExtensions
- EnumExtensions
- JsonExtensions
- GenericExtensions
String Extensions
IsDateTime()
Checks if date string with dateFormat is parsable to System.DateTime
format. True if is valid System.DateTime
else returns false.
/// data : datetime string
/// dateFormat : date format "dd/MM/yyyy" by default
public static bool IsDateTime(this string data, string dateFormat = "dd/MM/yyyy");
Example
var isDate = "09/10/2019".IsDateTime(); //Returns true.
isDate = "11/28/2019".IsDateTime("MM/dd/yyyy"); // Returns true
isDate = "11/28/2019".IsDateTime("dd/MM/yyyy"); // Returns false
IsInteger()
Checks if a string is a valid int32 value. Returns true if the string is a valid Integer, else returns false.
/// val : string value
public static bool IsInteger(this string val);
Example
var isNumber = "112".IsInteger(); //Returns true.
isNumber = "-23".IsInteger(); // Returns true
isNumber = "".IsInteger(); // Returns false
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
Feedback
Any feedback or issues can be added to the issues for this project in GitHub.
License
Copyright (c) Swagat Swain. All rights reserved.
Licensed under the MIT license.
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.