This commit is contained in:
2022-11-30 11:23:59 +08:00
parent fdaf7518c6
commit 5e17e20aab
15 changed files with 79 additions and 104 deletions

File diff suppressed because one or more lines are too long

View File

@ -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,

View File

@ -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);
}

View File

@ -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>