Skip to content

Commit

Permalink
合并
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Aug 29, 2024
2 parents 6771d17 + 5a4ed74 commit 65788e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
6 changes: 4 additions & 2 deletions NewLife.IoT/ThingSpecification/ThingSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ public String ToJson()

var jw = new JsonWriter
{
Indented = true,
//Indented = true,
IndentedLength = 2,
CamelCase = true,
//CamelCase = true,
EnumString = true,
};
jw.Options.WriteIndented = true;
jw.Options.CamelCase = true;
jw.Write(dic);

return jw.GetString();
Expand Down
23 changes: 0 additions & 23 deletions NewLife.IoT/TypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,4 @@ public static IDictionary<String, String> GetIoTTypes(Boolean full = false)
return _iotTypes = dic;
}
}

/// <summary>
/// 指定类型是否数字类型。包括整数、小数、字节、字符等
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static Boolean IsNumber(this Type type)
{
return type.GetTypeCode() switch
{
TypeCode.Boolean => false,
TypeCode.Byte or TypeCode.Char => true,
TypeCode.DateTime or TypeCode.DBNull => false,
TypeCode.Decimal or TypeCode.Double => true,
TypeCode.Empty => false,
TypeCode.Int16 or TypeCode.Int32 or TypeCode.Int64 => true,
TypeCode.Object => false,
TypeCode.SByte or TypeCode.Single => true,
TypeCode.String => false,
TypeCode.UInt16 or TypeCode.UInt32 or TypeCode.UInt64 => true,
_ => false,
};
}
}

0 comments on commit 65788e3

Please sign in to comment.