diff --git a/src/JT809.Protocol/Extensions/JT809EnumExtensions.cs b/src/JT809.Protocol/Extensions/JT809EnumExtensions.cs
index 6e3f45c..e774843 100644
--- a/src/JT809.Protocol/Extensions/JT809EnumExtensions.cs
+++ b/src/JT809.Protocol/Extensions/JT809EnumExtensions.cs
@@ -22,6 +22,17 @@ namespace JT809.Protocol.Extensions
return Convert.ToInt32(t);
}
+ ///
+ /// 转为 u16 整型
+ ///
+ ///
+ ///
+ ///
+ public static ushort ToUInt16Value(this T t) where T : struct
+ {
+ return Convert.ToUInt16(t);
+ }
+
///
/// 转为Byte
///
@@ -89,7 +100,7 @@ namespace JT809.Protocol.Extensions
///
/// 获取DescriptionAttribute特性枚举及描述
///
- ///
+ ///
///
public static Dictionary GetDescriptionAttributeDictionary(this Enum value)
{
@@ -106,7 +117,7 @@ namespace JT809.Protocol.Extensions
///
/// 获取DisplayNameAttribute特性枚举值的描述
///
- /// 枚举值
+ /// 枚举值
///
public static string GetDisplayName(this Enum value)
{
@@ -117,7 +128,7 @@ namespace JT809.Protocol.Extensions
///
/// 获取DisplayNameAttribute特性枚举及描述
///
- ///
+ ///
///
public static Dictionary GetDisplayNameAttributeDictionary(this Enum value)
{
@@ -152,18 +163,6 @@ namespace JT809.Protocol.Extensions
}
}
- ///
- /// 根据值获取对应枚举类型集合
- ///
- /// 具体枚举类型
- /// 枚举值
- /// 位数(8,16,32)
- ///
- public static IEnumerable GetEnumTypes(this int value,int digit) where T : Enum
- {
- return GetEnumTypes(value, digit,true);
- }
-
///
/// 根据值获取对应枚举类型集合
///
@@ -172,7 +171,7 @@ namespace JT809.Protocol.Extensions
/// 位数(8,16,32)
/// 是否忽略未知数据
///
- public static IEnumerable GetEnumTypes(this int value, int digit,bool ignoreUnknown) where T : Enum
+ public static IEnumerable GetEnumTypes(this int value, int digit, bool ignoreUnknown = false) where T : Enum
{
List values = new List();
for (int i = 0; i < digit; i++)