EasyExtensions 0.1.3
See the version list below for details.
dotnet add package EasyExtensions --version 0.1.3
NuGet\Install-Package EasyExtensions -Version 0.1.3
<PackageReference Include="EasyExtensions" Version="0.1.3" />
paket add EasyExtensions --version 0.1.3
#r "nuget: EasyExtensions, 0.1.3"
// Install EasyExtensions as a Cake Addin #addin nuget:?package=EasyExtensions&version=0.1.3 // Install EasyExtensions as a Cake Tool #tool nuget:?package=EasyExtensions&version=0.1.3
EasyExtensions
Ready-to-use .NET Standard library for convenient development.
Purposes
- Easy to use - just add a few lines of code to start working with the library.
- Flexible - use the library as a base for your project.
- Fast - add new features and commands in a few minutes.
- Modern - use the latest technologies and approaches.
- Secure - protect your data and users.
- Open Source - contribute to the project and make it better.
- Free - use the library for free.
- Cross-platform - run the library on any platform.
- Lightweight - use only necessary features.
- Documented - read the documentation and start using the library.
Getting Started
Start by importing the library into your project
dotnet add package EasyExtensions --version 0.1.3
Extensions
Byte Array Extensions
string SHA512(this byte[] bytes)
- Calculate SHA512 hash of byte array.
bytes
- Data to calculate hash.
returns
- SHA512 hash of byte array.
Claims Principal Extensions
int GetId(this ClaimsPrincipal? user)
- Get user id.
user
- User instance.
returns
- User id.
int TryGetId(this ClaimsPrincipal? user)
- Try get user id.
user
- User instance.
returns
- User id, or 0 if not found.
IEnumerable<string> GetRoles(this ClaimsPrincipal user, string rolePrefix = "")
- Get user roles.
user
- User instance.
rolePrefix
- Role prefix, for example: "user-group-" prefix returns group like "user-group-admins" </param>
returns
- User roles.
DateTime Extensions
DateTime DropMicroseconds(this DateTime value)
- Remove microseconds from DateTime.
value
- DateTime value.
returns
- DateTime without microseconds.
DateTimeOffset DropMicroseconds(this DateTimeOffset value)
- Remove microseconds from DateTimeOffset.
value
- DateTimeOffset value.
returns
- DateTimeOffset without microseconds.
DateTime ToUniversalTimeWithoutOffset(this DateTime value)
- Create new datetime with same values but DateTimeKind.Utc.
value
- DateTime value.
returns
- New datetime.
DateTime? ToNullable(this DateTime value)
- Convert datetime value to nullable datetime type.
value
- DateTime value.
returns
- Wrapped datetime value.
Exception Extensions
string ToStringWithInner(this Exception ex)
- Create string with error message from all inner exceptions if exists.
exception
- Exception instance.
returns
- Error message.
HttpRequest Extensions
string GetRemoteAddress(this HttpRequest request)
- Get remote host IP address using proxy "X-Real-IP", "CF-Connecting-IP", "X-Forwarded-For" headers, or connection remote IP address.
request
- HttpRequest instance.
returns
- IP address, or "Unknown" by default.
Math Extensions
int Pow(this int number, int exponent)
- Pow specified foundation to exponent.
number
- Foundation.
exponent
- Exponent of pow.
returns
- Calculation result.
Object Extensions
TObj MemberwiseClone<TObj>(this TObj obj)
- Clone object with MemberwiseClone.
obj
- Object to clone.
returns
- Cloned object.
ServiceCollection Extensions
IServiceCollection AddCpuUsageService(this IServiceCollection services)
- Adds CpuUsageService to the IServiceCollection.
services
- IServiceCollection instance.
returns
- Current IServiceCollection instance.
IServiceCollection AddRepositories(this IServiceCollection services)
- Add all types inherited from IRepository.
services
- IServiceCollection instance.
returns
- Current IServiceCollection instance.
Stream Extensions
byte[] ReadToEnd(this Stream stream)
- Reads the bytes from the current stream and writes them to the byte array.
stream
- Stream instance.
returns
- Received byte array.
Task<byte[]> ReadToEndAsync(this Stream stream)
- Asynchronously reads the bytes from the current stream and writes them to the byte array.
stream
- Stream instance.
returns
- Received byte array.
string SHA512(this Stream stream)
- Calculate SHA512 hash of byte stream.
stream
- Data to calculate hash.
returns
- SHA512 hash of byte stream.
String Extensions
string SHA512(this string str)
- Create SHA512 hash of specified text string.
str
- Text string.
returns
- SHA512 hash.
long ReadOnlyNumbers(this string str)
- Read only numbers from specified string.
str
- Text string.
returns
- Parsed number, or -1 by default.
string ToLowerFirstLetter(this string text)
- Make first letter as lower case. If text is null or whitespace - returns string.Empty.
text
- Text string.
returns
- Text with lower case first letter.
string ToUpperFirstLetter(this string text)
- Make first letter as upper case. If text is null or whitespace - returns string.Empty.
text
- Text string.
returns
- Text with upper case first letter.
Helpers
DateTime Helpers
DateTime ParseDateTimeOffset(string date)
- Parse DateTimeOffset from JSON format ISO 8601.
date
- Date string.
returns
- Parsed DateTimeOffset.
DateTime ParseDateTime(string time)
- Parse DateTime from JSON format ISO 8601.
datetime
- Date string.
returns
- Parsed DateTime.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
<p align="right"><a href="#readme-top">back to top</a></p>
License
Distributed under the MIT License. See LICENSE.md for more information.
Contact
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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | 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.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on EasyExtensions:
Package | Downloads |
---|---|
EasyExtensions.AspNetCore
Ready-to-use library for simplifying the development of .NET applications. |
|
EasyExtensions.Quartz
Ready-to-use library for simplifying the development of .NET applications. |
|
EasyExtensions.EntityFrameworkCore
Ready-to-use library for simplifying the development of .NET applications. |
|
EasyExtensions.Drawing
Ready-to-use library for simplifying the development of .NET applications. |
|
EasyExtensions.AspNetCore.Authorization
Ready-to-use library for simplifying the development of .NET applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.87 | 65 | 12/17/2024 |
0.1.86 | 442 | 12/8/2024 |
0.1.85 | 128 | 12/8/2024 |
0.1.84 | 550 | 11/19/2024 |
0.1.83 | 276 | 11/15/2024 |
0.1.82 | 136 | 11/15/2024 |
0.1.81 | 191 | 11/13/2024 |
0.1.80 | 344 | 11/10/2024 |
0.1.79 | 539 | 10/22/2024 |
0.1.78 | 165 | 10/21/2024 |
0.1.77 | 166 | 10/21/2024 |
0.1.76 | 126 | 10/21/2024 |
0.1.75 | 129 | 10/21/2024 |
0.1.74 | 118 | 10/21/2024 |
0.1.73 | 377 | 10/17/2024 |
0.1.72 | 247 | 10/16/2024 |
0.1.71 | 122 | 10/15/2024 |
0.1.70 | 223 | 10/15/2024 |
0.1.69 | 125 | 10/15/2024 |
0.1.68 | 217 | 10/15/2024 |
0.1.67 | 125 | 10/15/2024 |
0.1.66 | 211 | 10/14/2024 |
0.1.65 | 155 | 10/13/2024 |
0.1.64 | 126 | 10/13/2024 |
0.1.63 | 152 | 10/12/2024 |
0.1.62 | 162 | 10/12/2024 |
0.1.61 | 130 | 10/12/2024 |
0.1.60 | 198 | 10/12/2024 |
0.1.59 | 124 | 10/12/2024 |
0.1.58 | 188 | 10/11/2024 |
0.1.57 | 524 | 9/30/2024 |
0.1.56 | 129 | 9/30/2024 |
0.1.55 | 135 | 9/27/2024 |
0.1.54 | 155 | 9/27/2024 |
0.1.53 | 134 | 9/27/2024 |
0.1.52 | 161 | 9/24/2024 |
0.1.51 | 132 | 9/24/2024 |
0.1.50 | 194 | 9/24/2024 |
0.1.49 | 278 | 9/18/2024 |
0.1.48 | 182 | 9/17/2024 |
0.1.47 | 189 | 9/15/2024 |
0.1.46 | 277 | 8/22/2024 |
0.1.45 | 401 | 8/9/2024 |
0.1.44 | 158 | 8/7/2024 |
0.1.43 | 136 | 8/7/2024 |
0.1.42 | 148 | 8/7/2024 |
0.1.41 | 334 | 8/5/2024 |
0.1.40 | 156 | 8/5/2024 |
0.1.39 | 129 | 8/5/2024 |
0.1.38 | 127 | 8/5/2024 |
0.1.37 | 171 | 8/4/2024 |
0.1.36 | 129 | 8/3/2024 |
0.1.35 | 147 | 8/2/2024 |
0.1.34 | 145 | 8/2/2024 |
0.1.33 | 232 | 8/1/2024 |
0.1.32 | 133 | 8/1/2024 |
0.1.31 | 120 | 8/1/2024 |
0.1.30 | 122 | 8/1/2024 |
0.1.29 | 119 | 8/1/2024 |
0.1.28 | 160 | 8/1/2024 |
0.1.27 | 152 | 7/30/2024 |
0.1.26 | 116 | 7/30/2024 |
0.1.25 | 142 | 7/28/2024 |
0.1.24 | 122 | 7/27/2024 |
0.1.23 | 127 | 7/27/2024 |
0.1.22 | 180 | 7/27/2024 |
0.1.21 | 121 | 7/27/2024 |
0.1.20 | 125 | 7/27/2024 |
0.1.19 | 132 | 7/27/2024 |
0.1.18 | 147 | 7/26/2024 |
0.1.17 | 120 | 7/26/2024 |
0.1.16 | 148 | 7/26/2024 |
0.1.15 | 106 | 7/26/2024 |
0.1.14 | 107 | 7/26/2024 |
0.1.13 | 92 | 7/26/2024 |
0.1.12 | 98 | 7/26/2024 |
0.1.11 | 120 | 7/26/2024 |
0.1.10 | 94 | 7/26/2024 |
0.1.9 | 88 | 7/26/2024 |
0.1.8 | 88 | 7/26/2024 |
0.1.7 | 78 | 7/26/2024 |
0.1.6 | 71 | 7/26/2024 |
0.1.5 | 96 | 7/26/2024 |
0.1.4 | 53 | 7/26/2024 |
0.1.3 | 75 | 7/24/2024 |
0.1.2 | 71 | 7/23/2024 |
0.1.1 | 61 | 7/23/2024 |
0.1.0 | 61 | 7/23/2024 |