Skip to content

Commit 41a6d31

Browse files
committed
refactor: 移动扩展方法
1 parent f8801bc commit 41a6d31

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/BootstrapBlazor/Extensions/ObjectExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ public static string ConvertToPercentString(this string? val)
5050
/// <returns></returns>
5151
public static bool IsNumber(this Type t)
5252
{
53+
var separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
54+
if (separator != ".")
55+
{
56+
return false;
57+
}
58+
5359
var targetType = Nullable.GetUnderlyingType(t) ?? t;
5460
return targetType == typeof(int) || targetType == typeof(long) || targetType == typeof(short) ||
5561
targetType == typeof(float) || targetType == typeof(double) || targetType == typeof(decimal);

src/BootstrapBlazor/Utils/Utility.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Microsoft.Extensions.Localization;
88
using System.ComponentModel;
99
using System.Data;
10-
using System.Globalization;
1110
using System.Linq.Expressions;
1211
using System.Reflection;
1312

@@ -193,11 +192,6 @@ public static class Utility
193192
? null
194193
: CacheManager.GetPlaceholder(modelType, fieldName);
195194

196-
/// <summary>
197-
/// 获得 当前输入语言小数点分隔符
198-
/// </summary>
199-
private static string NumberDecimalSeparator => CultureInfo.CurrentCulture?.NumberFormat?.NumberDecimalSeparator ?? ".";
200-
201195
/// <summary>
202196
/// 通过 数据类型与字段名称获取 PropertyInfo 实例方法
203197
/// </summary>
@@ -644,7 +638,7 @@ private static Type GenerateComponentType(IEditorItem item)
644638
{
645639
ret = typeof(NullSwitch);
646640
}
647-
else if (fieldType.IsNumber() && NumberDecimalSeparator == ".")
641+
else if (fieldType.IsNumber())
648642
{
649643
ret = typeof(BootstrapInputNumber<>).MakeGenericType(fieldType);
650644
}

0 commit comments

Comments
 (0)