V.Common.Extensions 1.0.2

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

// Install V.Common.Extensions as a Cake Tool
#tool nuget:?package=V.Common.Extensions&version=1.0.2                

V.Common.Extensions

木叉一人工作室常用扩展方法封装

Nuget

V.Common.Extensions

HttpRequestExtension

ReadBody() 方法

从 HttpRequest 读取 String,读完后将 Stream Position 设置为 0

GetAbsoluteUrl() 方法

获取 HttpRequest 所对应的当前请求链接

GetAbsoluteUrl(string path) 方法

将 path 转换为绝对路径 url,/ 开头,不支持 ../

HttpResponseMessageExtension

ReadAsObj<T>() 方法

将 HttpResponseMessage 的内容读取为 T 对象

ReadAsString() 方法

将 HttpResponseMessage 的内容读取为 String

ReadAsDecompressedString() 方法

将 HttpResponseMessage 的 GZip 压缩内容读取为 String

ListExtension

IsNullOrEmpty() 方法

判断 IEnumerable<T> 是否为 null 或者长度为 0

ServiceCollectionExtension

AddTransientBothTypes 方法

为父类型和子类型同时添加服务实例,避免通过父类注入的时候,无法通过子类类型查找子类对象,反之亦然。可以避免通过父类注入时,通过 GetServices 获取所有对象再查找子类时导致的内存浪费

StringExtension

ToJson() 方法

使用 Newtonsoft.Json 将对象转换为 json 字符串

ToObj<T>() 方法

使用 Newtonsoft.Json 将 json 字符串转换为 T 对象

Md5() 方法

md5 hash

MaskMobile() 方法

将手机号中间四位转换为 * 得到脱敏手机号

IsValidMobile() 方法

使用正则表达式判断字符串是否为合法手机号

Sha1() 方法

SHA1 hash

DESEncrypt(byte[] key = null, byte[] iv = null) 方法

DES 加密,默认 key 为 Encoding.ASCII.GetBytes("670851ad"),默认 iv 为 Encoding.ASCII.GetBytes("89532a19")

DESDecrypt(byte[] key = null, byte[] iv = null) 方法

DES 解密,默认 key 为 Encoding.ASCII.GetBytes("670851ad"),默认 iv 为 Encoding.ASCII.GetBytes("89532a19")

Converter

FromString(string value, Type type)

将字符串转换为基础类型

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.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on V.Common.Extensions:

Package Downloads
V.User.OAuth

木叉一人工作室封装的 OAuth 类库,支持授权登录成功后进行自定义操作

V.Talog.Extension

木叉一人工作室开发的单机日志解决方案-扩展包

V.SwitchableCache

木叉一人工作室封装的缓存服务,可在本地内存以及redis之间切换

V.Finance

木叉一人工作室封装的金融数据获取、计算方法

V.Talog.Client

木叉一人工作室开发的单机日志解决方案-客户端

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 465 7/12/2024
1.0.2 691 4/12/2023
1.0.1 682 11/2/2022
1.0.0 2,248 10/4/2022