mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-06-21 01:48:15 +08:00
1.0.4
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@ public static class LoggerExtensions
|
||||
int callerLineNumber)
|
||||
{
|
||||
return
|
||||
$"{message} <s:{Thread.CurrentThread.ManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>";
|
||||
$"{message} <s:{Environment.CurrentManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>";
|
||||
}
|
||||
|
||||
public static void Debug(this ILogger me,
|
||||
|
@ -8,7 +8,7 @@ namespace NSExt.Extensions;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
private static readonly JsonSerializerOptions _DEFAULT_JSON_SERIALIZER_OPTIONS =
|
||||
private static readonly JsonSerializerOptions _defaultJsonSerializerOptions =
|
||||
default(JsonSerializerOptions).NewJsonSerializerOptions();
|
||||
|
||||
/// <summary>
|
||||
@ -300,6 +300,16 @@ public static class StringExtensions
|
||||
.ToLower(CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// html编码
|
||||
/// </summary>
|
||||
/// <param name="me"></param>
|
||||
/// <returns></returns>
|
||||
public static string Html(this string me)
|
||||
{
|
||||
return HttpUtility.HtmlEncode(me);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解码html编码
|
||||
/// </summary>
|
||||
@ -450,7 +460,7 @@ public static class StringExtensions
|
||||
/// <returns>反序列化后生成的对象</returns>
|
||||
public static T Object<T>(this string me, JsonSerializerOptions options = null)
|
||||
{
|
||||
return JsonSerializer.Deserialize<T>(me, options ?? _DEFAULT_JSON_SERIALIZER_OPTIONS);
|
||||
return JsonSerializer.Deserialize<T>(me, options ?? _defaultJsonSerializerOptions);
|
||||
}
|
||||
|
||||
|
||||
@ -463,7 +473,7 @@ public static class StringExtensions
|
||||
/// <returns>反序列化后生成的对象</returns>
|
||||
public static object Object(this string me, Type type, JsonSerializerOptions options = null)
|
||||
{
|
||||
return JsonSerializer.Deserialize(me, type, options ?? _DEFAULT_JSON_SERIALIZER_OPTIONS);
|
||||
return JsonSerializer.Deserialize(me, type, options ?? _defaultJsonSerializerOptions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<VersionPrefix>1.0.3</VersionPrefix>
|
||||
<Version>1.0.4</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user