20220313 3张表格 导出excel功能
This commit is contained in:
24
20220313_Excel/TempTask.WebEntry/Tools/Extension.cs
Normal file
24
20220313_Excel/TempTask.WebEntry/Tools/Extension.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TempTask.WebEntry.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// 扩展
|
||||
/// </summary>
|
||||
public static class Extension
|
||||
{
|
||||
/// <summary>
|
||||
/// 将字符串转换为整数
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <param name="defaultValue">转换失败时的默认值</param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt(this string str, int defaultValue = int.MinValue)
|
||||
{
|
||||
return int.TryParse(str, out int i) ? i : defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user