mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-13 06:54:51 +01:00
battle, ship boom boom
This commit is contained in:
30
BLHX.Server.Common/Utils/TypeExtensions.cs
Normal file
30
BLHX.Server.Common/Utils/TypeExtensions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLHX.Server.Common.Utils
|
||||
{
|
||||
public static class TypeExtensions
|
||||
{
|
||||
static readonly HashSet<Type> numericTypes =
|
||||
[
|
||||
typeof(byte),
|
||||
typeof(sbyte),
|
||||
typeof(short),
|
||||
typeof(ushort),
|
||||
typeof(int),
|
||||
typeof(uint),
|
||||
typeof(float),
|
||||
typeof(long),
|
||||
typeof(ulong),
|
||||
typeof(decimal)
|
||||
];
|
||||
|
||||
public static bool IsTypeNumeric(this Type type)
|
||||
{
|
||||
return numericTypes.Contains(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user