Skip to content

Fast.IaaS 公开 API

目标 netstandard2.1。本页为语法声明与 XML 注释参考,运行示例和边界见模块用法

源码提交:43554c07f6c216f80b509bd535c0a5b66ae7f2e8。维护流程:scripts/export-dotnet-api.ps1;普通站点构建直接消费此文件。

Fast.IaaS.EnumItem

源码 · 目标:netstandard2.1

csharp
public class EnumItem<TProperty> where TProperty : struct, IComparable, IConvertible, IFormattable

枚举项

  • 类型参数 TProperty:Value 属性类型

Fast.IaaS.EnumItem.Describe

源码 · 目标:netstandard2.1

csharp
public string Describe { set; get; }

枚举的描述

Fast.IaaS.EnumItem.Name

源码 · 目标:netstandard2.1

csharp
public string Name { set; get; }

枚举名称

Fast.IaaS.EnumItem.Value

源码 · 目标:netstandard2.1

csharp
public TProperty Value { set; get; }

枚举对象的值

Fast.IaaS.GlobalConstant

源码 · 目标:netstandard2.1

csharp
public static class GlobalConstant

常用常量

Fast.IaaS.GlobalConstant.DefaultTime

源码 · 目标:netstandard2.1

csharp
public static DateTime DefaultTime { get; }

默认 DateTime

Fast.IaaS.GlobalConstant.TimeStamp

源码 · 目标:netstandard2.1

csharp
public static long TimeStamp { get; }

时间戳

Fast.IaaS.GlobalConstant.SqlServerMinTime

源码 · 目标:netstandard2.1

csharp
public static DateTime SqlServerMinTime { get; }

SQL Server 最小时间

Fast.IaaS.GlobalConstant.SqlServerMaxTime

源码 · 目标:netstandard2.1

csharp
public static DateTime SqlServerMaxTime { get; }

SQL Server 最大时间

Fast.IaaS.GlobalConstant.SpecialSplitSymbol

源码 · 目标:netstandard2.1

csharp
public static char SpecialSplitSymbol { get; }

特殊分割符号

Fast.IaaS.GlobalConstant.SpecialMarkSymbol

源码 · 目标:netstandard2.1

csharp
public static char SpecialMarkSymbol { get; }

特殊标记符号

Fast.IaaS.AssemblyExtension

源码 · 目标:netstandard2.1

csharp
public static class AssemblyExtension

Assembly 提供扩展方法

Fast.IaaS.AssemblyExtension.GetTypes

源码 · 目标:netstandard2.1

csharp
public static Type[] GetTypes(this Assembly assembly, bool exported)

获取所有类型

  • 参数 assembly:目标程序集
  • 参数 exported:是否只返回导出的类型
  • 返回:获取到的所有类型集合

Fast.IaaS.AssemblyExtension.GetDescription

源码 · 目标:netstandard2.1

csharp
public static string GetDescription(this Assembly assembly)

获取程序集描述

  • 参数 assembly:目标程序集
  • 返回:获取到的程序集描述

Fast.IaaS.AssemblyExtension.GetVersion

源码 · 目标:netstandard2.1

csharp
public static Version GetVersion(this Assembly assembly)

获取程序集版本

  • 参数 assembly:目标程序集
  • 返回:获取到的程序集版本

Fast.IaaS.AssemblyExtension.GetAssemblyName

源码 · 目标:netstandard2.1

csharp
public static string GetAssemblyName(this Assembly assembly)

获取程序集名称

  • 参数 assembly:目标程序集
  • 返回:获取到的程序集名称

Fast.IaaS.AssemblyExtension.GetType

源码 · 目标:netstandard2.1

csharp
public static Type GetType(Assembly assembly, string typeFullName)

根据程序集和类型完整限定名获取运行时类型

  • 参数 assembly:目标程序集
  • 参数 typeFullName:目标类型的完全限定名
  • 返回:根据程序集和类型完整限定名获取运行时类型

Fast.IaaS.Base64Extension

源码 · 目标:netstandard2.1

csharp
public static class Base64Extension

提供 Base64 扩展方法

Fast.IaaS.Base64Extension.RandomPrefixStrLength = 6

源码 · 目标:netstandard2.1

csharp
public const int RandomPrefixStrLength = 6;

随机字符长度

Fast.IaaS.Base64Extension.ToBase64

源码 · 目标:netstandard2.1

csharp
public static string ToBase64(this string str, int randomPrefixStrLength = RandomPrefixStrLength)

普通 字符串 转换为 Base64 字符串

  • 参数 str:要处理的字符串
  • 参数 randomPrefixStrLength:随机前缀的字符数
  • 返回:普通 字符串 转换为 Base64 字符串

Fast.IaaS.Base64Extension.Base64ToString

源码 · 目标:netstandard2.1

csharp
public static string Base64ToString(this string base64Str, int randomPrefixStrLength = RandomPrefixStrLength)

Base64 字符串 转换为 普通 字符串

  • 参数 base64Str:要解码的 Base64 文本
  • 参数 randomPrefixStrLength:随机前缀的字符数
  • 返回:Base64 字符串 转换为 普通 字符串

Fast.IaaS.ConvertExtension

源码 · 目标:netstandard2.1

csharp
public static class ConvertExtension

Convert 提供转换扩展方法

Fast.IaaS.ConvertExtension.ParseToLong

源码 · 目标:netstandard2.1

csharp
public static long ParseToLong(this string value, bool isThrow = true, long defaultValue = 0L)

将 String 类型 转换为 Long 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:异常默认值,默认为 0L
  • 返回:将 String 类型 转换为 Long 类型

Fast.IaaS.ConvertExtension.ParseToLong

源码 · 目标:netstandard2.1

csharp
public static long ParseToLong<TEnum>(this TEnum value, bool isThrow = true, long defaultValue = 0L)
        where TEnum : struct, Enum

将 Enum 类型 转换为 Long 类型

  • 异常 ArgumentNullException:传入的枚举值为空
  • 参数 value:枚举值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:异常默认值,默认为 0L
  • 类型参数 TEnum:枚举类型
  • 返回:将 Enum 类型 转换为 Long 类型

Fast.IaaS.ConvertExtension.ParseToLong

源码 · 目标:netstandard2.1

csharp
public static long ParseToLong<TEnum>(this TEnum? value, bool isThrow = true, long defaultValue = 0L)
        where TEnum : struct, Enum

将 可空的 Enum 类型 转换为 Long 类型

  • 异常 ArgumentNullException:传入的枚举值为空
  • 参数 value:枚举值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:异常默认值,默认为 0L
  • 类型参数 TEnum:枚举类型
  • 返回:将 可空的 Enum 类型 转换为 Long 类型

Fast.IaaS.ConvertExtension.ParseToInt

源码 · 目标:netstandard2.1

csharp
public static int ParseToInt(this string value, bool isThrow = true, int defaultValue = 0)

将 String 类型 转换为 Int 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:操作无法产生结果时使用的默认值
  • 返回:将 String 类型 转换为 Int 类型

Fast.IaaS.ConvertExtension.ParseToInt

源码 · 目标:netstandard2.1

csharp
public static int ParseToInt<TEnum>(this TEnum value, bool isThrow = true, int defaultValue = 0) where TEnum : struct, Enum

将 Enum 类型 转换为 Int 类型

  • 异常 ArgumentNullException:传入的枚举值为空
  • 参数 value:枚举值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:操作无法产生结果时使用的默认值
  • 类型参数 TEnum:枚举类型
  • 返回:将 Enum 类型 转换为 Int 类型

Fast.IaaS.ConvertExtension.ParseToInt

源码 · 目标:netstandard2.1

csharp
public static int ParseToInt<TEnum>(this TEnum? value, bool isThrow = true, int defaultValue = 0) where TEnum : struct, Enum

将 可空的 Enum 类型 转换为 Int 类型

  • 异常 ArgumentNullException:传入的枚举值为空
  • 参数 value:枚举值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:操作无法产生结果时使用的默认值
  • 类型参数 TEnum:枚举类型
  • 返回:将 可空的 Enum 类型 转换为 Int 类型

Fast.IaaS.ConvertExtension.ParseToShort

源码 · 目标:netstandard2.1

csharp
public static short ParseToShort(this string value, bool isThrow = true, short defaultValue = 0)

将 String 类型 转换为 Short 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:short 异常默认值,默认为 0
  • 返回:将 String 类型 转换为 Short 类型

Fast.IaaS.ConvertExtension.ParseToDecimal

源码 · 目标:netstandard2.1

csharp
public static decimal ParseToDecimal(this string value, bool isThrow = true, decimal defaultValue = 0M)

将 String 类型 转换为 Decimal 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:decimal 异常默认值,默认为 0M
  • 返回:将 String 类型 转换为 Decimal 类型

Fast.IaaS.ConvertExtension.ParseToBool

源码 · 目标:netstandard2.1

csharp
public static bool ParseToBool(this string value, bool isThrow = true, bool defaultValue = false)

将 String 类型 转换为 Bool 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:异常默认值,默认为 false
  • 返回:解析得到的布尔值;禁用异常且输入无效时返回 defaultValue

Fast.IaaS.ConvertExtension.ParseToFloat

源码 · 目标:netstandard2.1

csharp
public static float ParseToFloat(this string value, bool isThrow = true, float defaultValue = 0F)

将 String 类型 转换为 Float 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:float 异常默认值,默认为 0F
  • 返回:将 String 类型 转换为 Float 类型

Fast.IaaS.ConvertExtension.ParseToDouble

源码 · 目标:netstandard2.1

csharp
public static double ParseToDouble(this string value, bool isThrow = true, double defaultValue = 0D)

将 String 类型 转换为 Float 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:double 异常默认值,默认为 0D
  • 返回:将 String 类型 转换为 Float 类型

Fast.IaaS.ConvertExtension.ParseToGuid

源码 · 目标:netstandard2.1

csharp
public static Guid ParseToGuid(this string value, bool isThrow = true, Guid? defaultValue = null)

将 String 类型 转换为 Guid 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:Guid 异常默认值,默认为 Guid.Empty
  • 返回:将 String 类型 转换为 Guid 类型

Fast.IaaS.ConvertExtension.ParseToDateTime

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime(this string value, bool isThrow = true, DateTime defaultValue = default)

将 String 类型 转换为 DateTime 类型

  • 异常 ArgumentNullException:传入的值为空或者空字符串
  • 参数 value:要转换的值
  • 参数 isThrow:处理失败时是否抛出异常
  • 参数 defaultValue:DateTime 异常默认值,默认为 DateTime.MinValue
  • 返回:将 String 类型 转换为 DateTime 类型

Fast.IaaS.ConvertExtension.ParseToDateTime

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime(this DateTimeOffset dateTime)

将 DateTimeOffset 转换成本地 DateTime

  • 参数 dateTime:要处理的日期时间
  • 返回:将 DateTimeOffset 转换成本地 DateTime

Fast.IaaS.ConvertExtension.ParseToDateTime

源码 · 目标:netstandard2.1

csharp
public static DateTime? ParseToDateTime(this DateTimeOffset? dateTime)

将 DateTimeOffset? 转换成本地 DateTime

  • 参数 dateTime:要处理的日期时间
  • 返回:将 DateTimeOffset? 转换成本地 DateTime

Fast.IaaS.ConvertExtension.ParseToDateTimeOffset

源码 · 目标:netstandard2.1

csharp
public static DateTimeOffset ParseToDateTimeOffset(this DateTime dateTime)

将 DateTime 转换成 DateTimeOffset

  • 参数 dateTime:要处理的日期时间
  • 返回:将 DateTime 转换成 DateTimeOffset

Fast.IaaS.ConvertExtension.ParseToDateTimeOffset

源码 · 目标:netstandard2.1

csharp
public static DateTimeOffset? ParseToDateTimeOffset(this DateTime? dateTime)

将 DateTime? 转换成 DateTimeOffset

  • 参数 dateTime:要处理的日期时间
  • 返回:将 DateTime? 转换成 DateTimeOffset

Fast.IaaS.ConvertExtension.ParseToDateTime_Milliseconds

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime_Milliseconds(this long timeStamps)

将毫秒时间戳转换为 DateTime,若转换失败,则返回日期最小值。不抛出异常

  • 参数 timeStamps:时间戳集合
  • 返回:将毫秒时间戳转换为 DateTime,若转换失败,则返回日期最小值。不抛出异常

Fast.IaaS.ConvertExtension.ParseToDateTime_Milliseconds

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime_Milliseconds(this long timeStamps, DateTime? defaultValue)

将毫秒时间戳转换为 DateTime,若转换失败,则返回默认值

  • 参数 timeStamps:时间戳集合
  • 参数 defaultValue:时间戳为 0 或转换失败时返回的默认值
  • 返回:将毫秒时间戳转换为 DateTime,若转换失败,则返回默认值

Fast.IaaS.ConvertExtension.ParseToDateTime_Seconds

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime_Seconds(this long timeStamps)

将秒时间戳转换为 DateTime,若转换失败,则返回日期最小值。不抛出异常

  • 参数 timeStamps:时间戳集合
  • 返回:将秒时间戳转换为 DateTime,若转换失败,则返回日期最小值。不抛出异常

Fast.IaaS.ConvertExtension.ParseToDateTime_Seconds

源码 · 目标:netstandard2.1

csharp
public static DateTime ParseToDateTime_Seconds(this long timeStamps, DateTime? defaultValue)

将秒时间戳转换为 DateTime,若转换失败,则返回默认值

  • 参数 timeStamps:时间戳集合
  • 参数 defaultValue:时间戳为 0 或转换失败时返回的默认值
  • 返回:将秒时间戳转换为 DateTime,若转换失败,则返回默认值

Fast.IaaS.ConvertExtension.ParseToUnixTime

源码 · 目标:netstandard2.1

csharp
public static long ParseToUnixTime(this DateTime dateTime)

将 DateTime 转为 UnixTime

  • 参数 dateTime:要处理的日期时间
  • 返回:将 DateTime 转为 UnixTime

Fast.IaaS.ConvertExtension.CastSuper

源码 · 目标:netstandard2.1

csharp
public static IEnumerable<TResult> CastSuper<TResult>(this IEnumerable source)

强制转换类型

  • 参数 source:源对象
  • 类型参数 TResult:操作结果类型
  • 返回:强制转换类型集合

Fast.IaaS.DataTableExtension

源码 · 目标:netstandard2.1

csharp
public static class DataTableExtension

DataTable 提供扩展方法

Fast.IaaS.DataTableExtension.ToDataTable

源码 · 目标:netstandard2.1

csharp
public static DataTable ToDataTable<T>(this IEnumerable<T> data)

转换为 DataTable

  • 参数 data:要处理或传输的数据
  • 类型参数 T:数据表行对应的模型类型
  • 返回:转换后的为 DataTable

Fast.IaaS.DataTableExtension.ToList

源码 · 目标:netstandard2.1

csharp
public static List<T> ToList<T>(this DataTable dataTable) where T : new()

DataTable To List

  • 参数 dataTable:要转换的数据表
  • 类型参数 T:数据表行对应的模型类型
  • 返回:DataTable To List 集合

Fast.IaaS.DateTimeExtension

源码 · 目标:netstandard2.1

csharp
public static class DateTimeExtension

DateTime 提供扩展方法

Fast.IaaS.DateTimeExtension.GetSayHello

源码 · 目标:netstandard2.1

csharp
public static string GetSayHello(this DateTime dateTime)

得到问好

  • 参数 dateTime:要处理的日期时间
  • 返回:得到问好

Fast.IaaS.DateTimeExtension.GetCurMonthFirstDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetCurMonthFirstDay(this DateTime dateTime)

获取当前月的第一天

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的当前月的第一天

Fast.IaaS.DateTimeExtension.GetCurMonthLastDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetCurMonthLastDay(this DateTime dateTime)

获取当前月的最后一天

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的当前月的最后一天

Fast.IaaS.DateTimeExtension.GetUpMonthFirstDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetUpMonthFirstDay(this DateTime dateTime)

获取上月的第一天

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的上月的第一天

Fast.IaaS.DateTimeExtension.GetUpMonthLastDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetUpMonthLastDay(this DateTime dateTime)

获取上月的最后一天

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的上月的最后一天

Fast.IaaS.DateTimeExtension.GetCurWeekDay

源码 · 目标:netstandard2.1

csharp
public static (DateTime startTime, DateTime lastTime) GetCurWeekDay(this DateTime dateTime)

获取本周时间

  • 参数 dateTime:要处理的日期时间
  • 返回:时间范围的起始时间和结束时间

Fast.IaaS.DateTimeExtension.GetUpWeekDay

源码 · 目标:netstandard2.1

csharp
public static (DateTime startTime, DateTime lastTime) GetUpWeekDay(this DateTime dateTime)

获取上周时间

  • 参数 dateTime:要处理的日期时间
  • 返回:时间范围的起始时间和结束时间

Fast.IaaS.DateTimeExtension.GetCurDay

源码 · 目标:netstandard2.1

csharp
public static (DateTime startTime, DateTime lastTime) GetCurDay(this DateTime dateTime)

获取当天时间

  • 参数 dateTime:要处理的日期时间
  • 返回:时间范围的起始时间和结束时间

Fast.IaaS.DateTimeExtension.GetUpDay

源码 · 目标:netstandard2.1

csharp
public static (DateTime startTime, DateTime lastTime) GetUpDay(this DateTime dateTime)

获取昨天时间

  • 参数 dateTime:要处理的日期时间
  • 返回:时间范围的起始时间和结束时间

Fast.IaaS.DateTimeExtension.GetZodiac

源码 · 目标:netstandard2.1

csharp
public static string GetZodiac(this DateTime dateTime)

获取生肖

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的生肖

Fast.IaaS.DateTimeExtension.GetConstellation

源码 · 目标:netstandard2.1

csharp
public static string GetConstellation(this DateTime dateTime)

获取星座

  • 参数 dateTime:要处理的日期时间
  • 返回:获取到的星座

Fast.IaaS.DateTimeExtension.GetLifeCode

源码 · 目标:netstandard2.1

csharp
public static int GetLifeCode(this DateTime dateTime)

生命密码

  • 参数 dateTime:要处理的日期时间
  • 返回:生命密码

Fast.IaaS.DecimalExtension

源码 · 目标:netstandard2.1

csharp
public static class DecimalExtension

decimal 提供扩展方法

Fast.IaaS.DecimalExtension.GetPercentage

源码 · 目标:netstandard2.1

csharp
public static string GetPercentage(this decimal data)

得到百分比

  • 参数 data:要处理或传输的数据
  • 返回:得到百分比

Fast.IaaS.DecimalExtension.GetPercentage

源码 · 目标:netstandard2.1

csharp
public static string GetPercentage(this decimal num1, decimal num2)

得到百分比

  • 参数 num1:参与计算的第一个数值
  • 参数 num2:参与计算的第二个数值
  • 返回:得到百分比

Fast.IaaS.DecimalExtension.GetDecimal

源码 · 目标:netstandard2.1

csharp
public static decimal GetDecimal(this decimal data, int? places = null)

获取 decimal,小数点后面有几位就保留几位

  • 参数 data:要处理或传输的数据
  • 参数 places:保留的小数位数
  • 返回:获取到的 decimal,小数点后面有几位就保留几位

Fast.IaaS.EnumExtension

源码 · 目标:netstandard2.1

csharp
public static class EnumExtension

Enum 提供扩展方法

Fast.IaaS.EnumExtension.GetDescription

源码 · 目标:netstandard2.1

csharp
public static string GetDescription<TEnum>(this TEnum value) where TEnum : struct, Enum

获取枚举值的描述

说明:需要有 [Description] 特性,否则返回的是枚举值的 Name

  • 异常 ArgumentNullException:传入的枚举值为空
  • 异常 ArgumentException:The parameter is not an enum type
  • 参数 value:要转换为枚举的名称或数值
  • 类型参数 TEnum:枚举类型
  • 返回:枚举的 [Description] 特性描述

Fast.IaaS.EnumExtension.GetDescription

源码 · 目标:netstandard2.1

csharp
public static string GetDescription(this Enum value, Type enumType)

获取枚举值的描述

说明:需要有 [Description] 特性,否则返回的是枚举值的 Name

  • 异常 ArgumentNullException:传入的枚举值为空
  • 异常 ArgumentException:The parameter is not an enum type
  • 参数 value:Enum 枚举值
  • 参数 enumType:enum 类型
  • 返回:枚举的 [Description] 特性描述

Fast.IaaS.EnumExtension.EnumToList

源码 · 目标:netstandard2.1

csharp
public static List<EnumItem<int>> EnumToList(this Type enumType)

将枚举转成枚举信息集合

  • 异常 ArgumentException:类型不是一个枚举类型
  • 参数 enumType:enum 类型
  • 返回:将枚举转成枚举信息集合集合

Fast.IaaS.EnumExtension.EnumToList

源码 · 目标:netstandard2.1

csharp
public static List<EnumItem<TProperty>> EnumToList<TProperty>(this Type enumType)
        where TProperty : struct, IComparable, IConvertible, IFormattable

将枚举转成枚举信息集合

  • 异常 ArgumentException:类型不是一个枚举类型
  • 参数 enumType:enum 类型
  • 类型参数 TProperty:属性值类型
  • 返回:将枚举转成枚举信息集合集合

Fast.IaaS.FieldInfoExtension

源码 · 目标:netstandard2.1

csharp
public static class FieldInfoExtension

FieldInfo 提供扩展方法

Fast.IaaS.FieldInfoExtension.GetDescriptionValue

源码 · 目标:netstandard2.1

csharp
public static T GetDescriptionValue<T>(this FieldInfo field) where T : Attribute

获取字段特性

  • 参数 field:目标字段
  • 类型参数 T:要读取的特性类型
  • 返回:获取到的字段特性

Fast.IaaS.GroupByExtension

源码 · 目标:netstandard2.1

csharp
public static class GroupByExtension

EnumExtension 提供 GroupBy 扩展方法

Fast.IaaS.GroupByExtension.GroupByMultiple

源码 · 目标:netstandard2.1

csharp
public static IEnumerable<IGrouping<string, TKey>> GroupByMultiple<TKey>(this IEnumerable<TKey> source,
        params Expression<Func<TKey, object>>[] groupByProperties)

多个 GroupBy

  • 参数 source:源对象
  • 参数 groupByProperties:参与分组的属性名称集合
  • 类型参数 TKey:键类型
  • 返回:多个 GroupBy 集合

Fast.IaaS.IDictionaryExtension

源码 · 目标:netstandard2.1

csharp
public static class IDictionaryExtension

IDictionary{TKey,TValue} 提供扩展方法

Fast.IaaS.IDictionaryExtension.ToQueryString

源码 · 目标:netstandard2.1

csharp
public static string ToQueryString(this IDictionary<string, string> dict, bool urlEncode = true, bool isToLower = false)

将一个字典转化为 QueryString

  • 参数 dict:要处理的字典
  • 参数 urlEncode:是否对生成的查询字符串执行 URL 编码
  • 参数 isToLower:是否将名称的首字母转换为小写
  • 返回:将一个字典转化为 QueryString

Fast.IaaS.IDictionaryExtension.RemoveEmptyValueItems

源码 · 目标:netstandard2.1

csharp
public static void RemoveEmptyValueItems(this IDictionary<string, string> dict)

移除空值项

  • 参数 dict:IDictionary

Fast.IaaS.IDictionaryExtension.AddOrUpdate

源码 · 目标:netstandard2.1

csharp
public static void AddOrUpdate<TKey, TValue>(this Dictionary<TKey, List<TValue>> dictionary, TKey key, TValue value)
        where TKey : notnull

添加或更新

  • 参数 dictionary:IDictionary
  • 参数 key:字典键
  • 参数 value:要添加或替换的字典值
  • 类型参数 TKey:字典键类型
  • 类型参数 TValue:字典值类型

Fast.IaaS.IDictionaryExtension.AddOrUpdate

源码 · 目标:netstandard2.1

csharp
public static void AddOrUpdate<TKey, TValue>(this IDictionary<TKey, List<TValue>> dictionary,
        IDictionary<TKey, List<TValue>> concatDictionary) where TKey : notnull

添加或更新

  • 参数 dictionary:IDictionary
  • 参数 concatDictionary:要与当前字典合并的数据
  • 类型参数 TKey:字典键类型
  • 类型参数 TValue:字典值类型

Fast.IaaS.IDictionaryExtension.AddOrUpdate

源码 · 目标:netstandard2.1

csharp
public static void AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> dictionary,
        IDictionary<TKey, TValue> concatDictionary) where TKey : notnull

添加或更新

  • 参数 dictionary:IDictionary
  • 参数 concatDictionary:要与当前字典合并的数据
  • 类型参数 TKey:字典键类型
  • 类型参数 TValue:字典值类型

Fast.IaaS.IDictionaryExtension.AddOrUpdate

源码 · 目标:netstandard2.1

csharp
public static IDictionary<string, T> AddOrUpdate<T>(this IDictionary<string, T> dic, IDictionary<string, T> newDic)

合并两个字典

  • 参数 dic:IDictionary{TKey,TValue}字典
  • 参数 newDic:IDictionary{TKey,TValue}新字典
  • 类型参数 T:字典值的类型
  • 返回:IDictionary

Fast.IaaS.IDictionaryExtension.DicToXmlStr

源码 · 目标:netstandard2.1

csharp
public static string DicToXmlStr(this IDictionary<string, object> dic)

将 Dic 字典转换成字符串

  • 参数 dic:IDictionary
  • 返回:将 Dic 字典转换成字符串

Fast.IaaS.IDictionaryExtension.XmlStrToDic

源码 · 目标:netstandard2.1

csharp
public static IDictionary<string, object> XmlStrToDic(this string xml)

将字符串转换为 Dic 字典

  • 参数 xml:要解析的 XML 文本
  • 返回:IDictionary

Fast.IaaS.IDictionaryExtension.SortDicToXmlStr

源码 · 目标:netstandard2.1

csharp
public static string SortDicToXmlStr(this SortedDictionary<string, object> dic)

将 Dic 字典转换成字符串

  • 参数 dic:IDictionary
  • 返回:将 Dic 字典转换成字符串

Fast.IaaS.IDictionaryExtension.XmlStrToSortDic

源码 · 目标:netstandard2.1

csharp
public static SortedDictionary<string, object> XmlStrToSortDic(this string xml)

将字符串转换为 Dic 字典

  • 参数 xml:要解析的 XML 文本
  • 返回:SortedDictionary

Fast.IaaS.LinqExpressionExtension

源码 · 目标:netstandard2.1

csharp
public static class LinqExpressionExtension

Expression 提供扩展方法

Fast.IaaS.LinqExpressionExtension.GetPropertyName

源码 · 目标:netstandard2.1

csharp
public static string GetPropertyName<T, TProperty>(this Expression<Func<T, TProperty>> propertySelector)

解析表达式属性名称

  • 异常 ArgumentException:Expression is not valid for property selection
  • 参数 propertySelector:用于选择目标属性的表达式
  • 类型参数 T:表达式参数所表示的对象类型
  • 类型参数 TProperty:属性值类型
  • 返回:解析后的表达式属性名称

Fast.IaaS.LinqExpressionExtension.GetPropertyName

源码 · 目标:netstandard2.1

csharp
public static string GetPropertyName<T>(MemberExpression memberExpression)

解析表达式属性名称

  • 异常 ArgumentException:Invalid property selection
  • 参数 memberExpression:用于解析表达式属性名称的表达式
  • 类型参数 T:表达式参数所表示的对象类型
  • 返回:解析后的表达式属性名称

Fast.IaaS.MethodInfoExtension

源码 · 目标:netstandard2.1

csharp
public static class MethodInfoExtension

MethodInfo 提供扩展方法

Fast.IaaS.MethodInfoExtension.IsAsync

源码 · 目标:netstandard2.1

csharp
public static bool IsAsync(this MethodInfo methodInfo)

判断方法是否是异步

  • 参数 methodInfo:目标方法的反射元数据
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.MethodInfoExtension.GetRealReturnType

源码 · 目标:netstandard2.1

csharp
public static Type GetRealReturnType(this MethodInfo methodInfo)

获取方法真实返回类型

  • 参数 methodInfo:目标方法的反射元数据
  • 返回:获取到的方法真实返回类型

Fast.IaaS.MethodInfoExtension.GetFoundAttribute

源码 · 目标:netstandard2.1

csharp
public static TAttribute GetFoundAttribute<TAttribute>(this MethodInfo methodInfo, bool inherit) where TAttribute : Attribute

查找方法指定特性,如果没找到则继续查找声明类

  • 参数 methodInfo:目标方法的反射元数据
  • 参数 inherit:是否在基类型中继续查找成员或特性
  • 类型参数 TAttribute:要查找的特性类型
  • 返回:查找方法指定特性,如果没找到则继续查找声明类

Fast.IaaS.MethodInfoExtension.GetFoundAttribute

源码 · 目标:netstandard2.1

csharp
public static Attribute GetFoundAttribute(this MethodInfo methodInfo, Type attributeType, bool inherit)

查找方法指定特性,如果没找到则继续查找声明类

  • 参数 methodInfo:目标方法的反射元数据
  • 参数 attributeType:要读取的特性类型
  • 参数 inherit:是否在基类型中继续查找成员或特性
  • 返回:查找方法指定特性,如果没找到则继续查找声明类

Fast.IaaS.MethodInfoExtension.GetMethodParameterCount

源码 · 目标:netstandard2.1

csharp
public static int GetMethodParameterCount(this MethodInfo methodInfo)

获取方法参数数量

  • 参数 methodInfo:目标方法的反射元数据
  • 返回:满足条件的项数

Fast.IaaS.ObjectExtension

源码 · 目标:netstandard2.1

csharp
public static class ObjectExtension

object 提供扩展方法

Fast.IaaS.ObjectExtension.ChangeType

源码 · 目标:netstandard2.1

csharp
public static object ChangeType(this object obj, Type type)

将一个对象转换为指定类型

  • 参数 obj:要处理的对象
  • 参数 type:目标类型
  • 返回:将一个对象转换为指定类型

Fast.IaaS.ObjectExtension.ToDictionary

源码 · 目标:netstandard2.1

csharp
public static IDictionary<string, object> ToDictionary(this object obj, bool includeNull = false)

将一个 Object 对象转为 字典

  • 参数 obj:要处理的对象
  • 参数 includeNull:是否在结果中包含值为 null 的属性
  • 返回:IDictionary

Fast.IaaS.ObjectExtension.ChangeType

源码 · 目标:netstandard2.1

csharp
public static T ChangeType<T>(this object obj)

将一个对象转换为指定类型

  • 参数 obj:要处理的对象
  • 类型参数 T:转换操作使用的对象类型
  • 返回:将一个对象转换为指定类型

Fast.IaaS.ObjectExtension.ToQueryString

源码 · 目标:netstandard2.1

csharp
public static string ToQueryString(this object obj, bool isToLower = false)

将对象的公共属性转换为查询字符串

说明:字符串和整数列表会使用带 [] 后缀的重复查询参数;其他复杂属性使用其字符串表示形式

  • 参数 obj:要转换的对象
  • 参数 isToLower:是否将属性名的首字母转换为小写
  • 返回:由非空公共属性组成的查询字符串;对象为空时返回空字符串

Fast.IaaS.ObjectExtension.TryGetCount

源码 · 目标:netstandard2.1

csharp
public static bool TryGetCount(this object obj, out int count)

尝试获取对象的数量

  • 参数 obj:要处理的对象
  • 参数 count:得到的元素数量
  • 返回:能够读取字符、字符串、集合或公开 Count 属性的数量时返回 true;否则返回 false

Fast.IaaS.StringEncodingExtension

源码 · 目标:netstandard2.1

csharp
public static class StringEncodingExtension

提供字符串编码扩展方法

Fast.IaaS.StringEncodingExtension.EnAscii

源码 · 目标:netstandard2.1

csharp
public static string EnAscii(this string str)

将字符串转换为 ASCII 编码形式

  • 参数 str:要处理的字符串
  • 返回:转换后的 ASCII 编码形式字符串

Fast.IaaS.StringEncodingExtension.DeAscii

源码 · 目标:netstandard2.1

csharp
public static string DeAscii(this string str)

将 ASCII 编码形式的字符串转换为字符串

  • 参数 str:要处理的字符串
  • 返回:将 ASCII 编码形式的字符串转换为字符串

Fast.IaaS.StringEncodingExtension.EnUnicode

源码 · 目标:netstandard2.1

csharp
public static string EnUnicode(this string str)

Unicode 编码

  • 参数 str:要处理的字符串
  • 返回:Unicode 编码

Fast.IaaS.StringEncodingExtension.DeUnicode

源码 · 目标:netstandard2.1

csharp
public static string DeUnicode(this string str)

Unicode 解码

  • 参数 str:要处理的字符串
  • 返回:Unicode 解码

Fast.IaaS.StringEncodingExtension.UrlEncode

源码 · 目标:netstandard2.1

csharp
public static string UrlEncode(this string str)

对字符串进行 URL 编码;已编码的字符串保持不变

  • 参数 str:要编码的字符串
  • 返回:URL 编码后的字符串;输入为空时返回空字符串

Fast.IaaS.StringEncodingExtension.UrlDecode

源码 · 目标:netstandard2.1

csharp
public static string UrlDecode(this string str)

将一个 URL 编码 转为字符串

  • 参数 str:要处理的字符串
  • 返回:将一个 URL 编码 转为字符串

Fast.IaaS.StringExtension

源码 · 目标:netstandard2.1

csharp
public static class StringExtension

string 提供扩展方法

Fast.IaaS.StringExtension.FirstCharToUpper

源码 · 目标:netstandard2.1

csharp
public static string FirstCharToUpper(this string str)

字符串首字母大写

  • 参数 str:要处理的字符串
  • 返回:字符串首字母大写

Fast.IaaS.StringExtension.FirstCharToLower

源码 · 目标:netstandard2.1

csharp
public static string FirstCharToLower(this string str)

字符串首字母小写

  • 参数 str:要处理的字符串
  • 返回:字符串首字母小写

Fast.IaaS.StringExtension.SplitCamelCase

源码 · 目标:netstandard2.1

csharp
public static string[] SplitCamelCase(this string str)

切割骆驼命名式字符串

  • 参数 str:要处理的字符串
  • 返回:切割骆驼命名式字符串集合

Fast.IaaS.StringExtension.ToCamelCase

源码 · 目标:netstandard2.1

csharp
public static string ToCamelCase(this string str)

字符串小驼峰命名

  • 参数 str:要处理的字符串
  • 返回:字符串小驼峰命名

Fast.IaaS.StringExtension.ClearStringAffixes

源码 · 目标:netstandard2.1

csharp
public static string ClearStringAffixes(this string str, int pos = 0, params string[] affixes)

清除字符串前后缀

  • 参数 str:要处理的字符串
  • 参数 pos:开始处理的位置
  • 参数 affixes:要移除或保留的前后缀集合
  • 返回:清除字符串前后缀

Fast.IaaS.StringExtension.Format

源码 · 目标:netstandard2.1

csharp
public static string Format(this string str, params object[] args)

格式化字符串

  • 参数 str:要处理的字符串
  • 参数 args:格式化消息时使用的参数
  • 返回:格式化字符串

Fast.IaaS.StringExtension.GetCharLength

源码 · 目标:netstandard2.1

csharp
public static int GetCharLength(this string str)

获取字符长度

  • 参数 str:要处理的字符串
  • 返回:获取到的字符长度

Fast.IaaS.StringExtension.PadStringLeftAlign

源码 · 目标:netstandard2.1

csharp
public static string PadStringLeftAlign(this string strTemp, int length)

将字符串转化为固定长度左对齐,右补空格

  • 参数 strTemp:递归处理过程中已累积的字符串
  • 参数 length:目标长度
  • 返回:将字符串转化为固定长度左对齐,右补空格

Fast.IaaS.StringExtension.PadStringRightAlign

源码 · 目标:netstandard2.1

csharp
public static string PadStringRightAlign(this string strTemp, int length)

将字符串转化为固定长度右对齐,左补空格

  • 参数 strTemp:递归处理过程中已累积的字符串
  • 参数 length:目标长度
  • 返回:将字符串转化为固定长度右对齐,左补空格

Fast.IaaS.StringExtension.SplitString

源码 · 目标:netstandard2.1

csharp
public static List<string> SplitString(this string strTemp, int length)

将字符串转换为固定长度的数组

  • 参数 strTemp:递归处理过程中已累积的字符串
  • 参数 length:目标长度
  • 返回:将字符串转换为固定长度的数组集合

Fast.IaaS.StringExtension.GetSubStringWithEllipsis

源码 · 目标:netstandard2.1

csharp
public static string GetSubStringWithEllipsis(this string value, int length, bool ellipsis = false)

截取指定长度的字符串

  • 参数 value:要处理的字符串
  • 参数 length:目标长度
  • 参数 ellipsis:文本被截断时追加的省略标记
  • 返回:截取指定长度的字符串

Fast.IaaS.StringExtension.GetNVarcharMaxLen

源码 · 目标:netstandard2.1

csharp
public static string GetNVarcharMaxLen(this string str, int maxLen, bool ellipsis = false)

获取 SQL Server NVarchar 最大字节长度

  • 参数 str:要处理的字符串
  • 参数 maxLen:目标长度
  • 参数 ellipsis:文本被截断时追加的省略标记
  • 返回:获取到的 SQL Server NVarchar 最大字节长度

Fast.IaaS.TimeSpanExtension

源码 · 目标:netstandard2.1

csharp
public static class TimeSpanExtension

TimeSpan 提供扩展方法

Fast.IaaS.TimeSpanExtension.ToDescription

源码 · 目标:netstandard2.1

csharp
public static string ToDescription(this TimeSpan timeSpan)

获取描述

  • 参数 timeSpan:要处理的时间间隔
  • 返回:获取到的描述

Fast.IaaS.TypeExtension

源码 · 目标:netstandard2.1

csharp
public static class TypeExtension

Type 提供扩展方法

Fast.IaaS.TypeExtension.HasImplementedRawGeneric

源码 · 目标:netstandard2.1

csharp
public static bool HasImplementedRawGeneric(this Type type, Type generic)

判断类型是否实现某个泛型

  • 参数 type:目标类型
  • 参数 generic:是否按泛型类型规则进行匹配
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.GetAssemblyName

源码 · 目标:netstandard2.1

csharp
public static string GetAssemblyName(this Type type)

获取类型所在程序集名称

  • 参数 type:目标类型
  • 返回:获取到的类型所在程序集名称

Fast.IaaS.TypeExtension.GetAssemblyName

源码 · 目标:netstandard2.1

csharp
public static string GetAssemblyName(this TypeInfo typeInfo)

获取类型所在程序集名称

  • 参数 typeInfo:目标类型的反射元数据
  • 返回:获取到的类型所在程序集名称

Fast.IaaS.TypeExtension.IsRichPrimitive

源码 · 目标:netstandard2.1

csharp
public static bool IsRichPrimitive(this Type type)

判断是否是富基元类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsValueTuple

源码 · 目标:netstandard2.1

csharp
public static bool IsValueTuple(this Type type)

判断是否是元组类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsStatic

源码 · 目标:netstandard2.1

csharp
public static bool IsStatic(this Type type)

检查类型是否是静态类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsAnonymous

源码 · 目标:netstandard2.1

csharp
public static bool IsAnonymous(this Type type)

检查类型是否是匿名类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsInstantiable

源码 · 目标:netstandard2.1

csharp
public static bool IsInstantiable(this Type type)

检查类型是否可实例化

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsAlienAssignableTo

源码 · 目标:netstandard2.1

csharp
public static bool IsAlienAssignableTo(this Type type, Type fromType)

检查类型是否派生自指定类型

  • 参数 type:目标类型
  • 参数 fromType:from 类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.GetDefinedCustomAttribute

源码 · 目标:netstandard2.1

csharp
public static TAttribute GetDefinedCustomAttribute<TAttribute>(this Type type, bool inherit = false)
        where TAttribute : Attribute

获取指定特性实例

说明:若特性不存在则返回 null

  • 参数 type:目标类型
  • 参数 inherit:是否在基类型中继续查找成员或特性
  • 类型参数 TAttribute:要查找的特性类型
  • 返回:获取到的指定特性实例

Fast.IaaS.TypeExtension.HasDefinePublicParameterlessConstructor

源码 · 目标:netstandard2.1

csharp
public static bool HasDefinePublicParameterlessConstructor(this Type type)

检查类型是否定义了公开无参构造函数

说明:用于 Activator.CreateInstance(Type) 实例化

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsDefinitionEqual

源码 · 目标:netstandard2.1

csharp
public static bool IsDefinitionEqual(this Type type, Type compareType)

检查类型和指定类型定义是否相等

  • 参数 type:目标类型
  • 参数 compareType:compare 类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsCompatibilityTo

源码 · 目标:netstandard2.1

csharp
public static bool IsCompatibilityTo(this Type type, Type inheritType)

检查类型和指定继承类型是否兼容

  • 参数 type:目标类型
  • 参数 inheritType:inherit 类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsDeclarationMethod

源码 · 目标:netstandard2.1

csharp
public static bool IsDeclarationMethod(this Type type, string name, BindingFlags accessibilityBindingFlags,
        out MethodInfo methodInfo)

检查类型是否定义了指定方法

  • 参数 type:目标类型
  • 参数 name:方法名称
  • 参数 accessibilityBindingFlags:用于筛选成员可见性的绑定标志
  • 参数 methodInfo:目标方法的反射元数据
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsInteger

源码 · 目标:netstandard2.1

csharp
public static bool IsInteger(this Type type)

检查类型是否是整数类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsDecimal

源码 · 目标:netstandard2.1

csharp
public static bool IsDecimal(this Type type)

检查类型是否是小数类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsNumeric

源码 · 目标:netstandard2.1

csharp
public static bool IsNumeric(this Type type)

检查类型是否是数值类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.IsDictionary

源码 · 目标:netstandard2.1

csharp
public static bool IsDictionary(this Type type)

检查类型是否是字典类型

  • 参数 type:目标类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.TypeExtension.GetTypeAttribute

源码 · 目标:netstandard2.1

csharp
public static TAttribute GetTypeAttribute<TAttribute>(this Type type, bool inherit = false) where TAttribute : Attribute

获取类型自定义特性

  • 参数 type:目标类型
  • 参数 inherit:是否在基类型中继续查找成员或特性
  • 类型参数 TAttribute:要查找的特性类型
  • 返回:获取到的类型自定义特性

Fast.IaaS.ValidateExtension

源码 · 目标:netstandard2.1

csharp
public static class ValidateExtension

提供验证扩展方法

Fast.IaaS.ValidateExtension.IsEmpty

源码 · 目标:netstandard2.1

csharp
public static bool IsEmpty(this string value)

判断 string 是否为 null

  • 参数 value:字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsEmpty

源码 · 目标:netstandard2.1

csharp
public static bool IsEmpty<TEnum>(this TEnum value) where TEnum : struct, Enum

判断 Enum 是否为 null

  • 参数 value:要验证的值
  • 类型参数 TEnum:枚举类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsEmpty

源码 · 目标:netstandard2.1

csharp
public static bool IsEmpty<TEnum>(this TEnum? value) where TEnum : struct, Enum

判断 Enum 是否为 null

  • 参数 value:要验证的值
  • 类型参数 TEnum:枚举类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero<TEnum>(this TEnum value) where TEnum : struct, Enum

判断 Enum 是否为 null 或者 0

  • 参数 value:要验证的值
  • 类型参数 TEnum:枚举类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero<TEnum>(this TEnum? value) where TEnum : struct, Enum

判断 Enum 是否为 null 或者 0

  • 参数 value:要验证的值
  • 类型参数 TEnum:枚举类型
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this byte? value)

判断 byte 是否为 null 或者 0

  • 参数 value:要验证的值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this int? value)

判断 int 是否为 null 或者 0

  • 参数 value:要验证的值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this double? value)

判断 double 是否为 null 或者 0

  • 参数 value:double 值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this decimal? value)

判断 decimal 是否为 null 或者 0

  • 参数 value:decimal 值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this float? value)

判断 float 是否为 null 或者 0

  • 参数 value:decimal 值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNullOrZero

源码 · 目标:netstandard2.1

csharp
public static bool IsNullOrZero(this long? value)

判断 long 是否为 null 或者 0

  • 参数 value:要验证的值
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNumber

源码 · 目标:netstandard2.1

csharp
public static bool IsNumber(this string str)

验证输入字符串为带小数点正数

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsDecimalNumber

源码 · 目标:netstandard2.1

csharp
public static bool IsDecimalNumber(this string str)

验证输入字符串为带小数点正负数

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsTel

源码 · 目标:netstandard2.1

csharp
public static bool IsTel(this string str)

验证中国电话格式是否有效,格式 010-85849685

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsPhone

源码 · 目标:netstandard2.1

csharp
public static bool IsPhone(this string str)

验证输入字符串为电话号码

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsFax

源码 · 目标:netstandard2.1

csharp
public static bool IsFax(this string str)

验证是否是有效传真号码

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsMobile

源码 · 目标:netstandard2.1

csharp
public static bool IsMobile(this string str)

验证手机号是否合法 号段为 13,14,15,16,17,18,19 0,86 开头将自动识别

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsIdCard

源码 · 目标:netstandard2.1

csharp
public static bool IsIdCard(this string str)

验证身份证是否有效

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsIdCard18

源码 · 目标:netstandard2.1

csharp
public static bool IsIdCard18(this string str)

验证输入字符串为 18 位的身份证号码

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsIdCard15

源码 · 目标:netstandard2.1

csharp
public static bool IsIdCard15(this string str)

验证输入字符串为 15 位的身份证号码

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsEmail

源码 · 目标:netstandard2.1

csharp
public static bool IsEmail(this string str)

验证是否是有效邮箱地址

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsQqEmail

源码 · 目标:netstandard2.1

csharp
public static bool IsQqEmail(this string str)

验证是否是有效 QQ 邮箱地址

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsOnlyChinese

源码 · 目标:netstandard2.1

csharp
public static bool IsOnlyChinese(this string strLn)

验证是否只含有汉字

  • 参数 strLn:要追加的文本行
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsBadString

源码 · 目标:netstandard2.1

csharp
public static bool IsBadString(this string str)

是否有多余的字符 防止 SQL 注入

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsNzx

源码 · 目标:netstandard2.1

csharp
public static bool IsNzx(this string str)

是否由数字、26 个英文字母或者下划线組成的字串

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsAlphaNumericChinese

源码 · 目标:netstandard2.1

csharp
public static bool IsAlphaNumericChinese(this string str)

由数字、26 个英文字母、汉字組成的字串

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsAlphaNumeric

源码 · 目标:netstandard2.1

csharp
public static bool IsAlphaNumeric(this string str)

是否由数字、26 个英文字母組成的字串

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsPostCode

源码 · 目标:netstandard2.1

csharp
public static bool IsPostCode(this string str)

验证输入字符串为邮政编码

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.CheckLength

源码 · 目标:netstandard2.1

csharp
public static bool CheckLength(this string str, int length)

检查对象的输入长度

  • 参数 str:要处理的字符串
  • 参数 length:目标长度
  • 返回:字符串长度恰好等于 length 时返回 true;否则返回 false

Fast.IaaS.ValidateExtension.IsDateTime

源码 · 目标:netstandard2.1

csharp
public static bool IsDateTime(this string str)

判断用户输入是否为日期

说明:可判断格式如下(其中-可替换为/,不影响验证)YYYY | YYYY-MM | YYYYMM | YYYY-MM-DD | YYYYMMDD | YYYY-MM-DD HH:MM:SS | YYYY-MM-DD HH:MM:SS.FFF

  • 参数 str:要处理的字符串
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.ITreeNode

源码 · 目标:netstandard2.1

csharp
public interface ITreeNode<out TProperty> where TProperty : struct, IComparable, IConvertible, IFormattable

树基类

  • 类型参数 TProperty:属性值类型

Fast.IaaS.ITreeNode.GetId

源码 · 目标:netstandard2.1

csharp
TProperty GetId();

获取节点 id

  • 返回:获取到的节点 id

Fast.IaaS.ITreeNode.GetPid

源码 · 目标:netstandard2.1

csharp
TProperty GetPid();

获取节点父 id

  • 返回:获取到的节点父 id

Fast.IaaS.ITreeNode.GetSort

源码 · 目标:netstandard2.1

csharp
TProperty GetSort();

获取排序字段

  • 返回:获取到的排序字段

Fast.IaaS.ITreeNode.SetChildren

源码 · 目标:netstandard2.1

csharp
void SetChildren(IList children);

设置 Children

  • 参数 children:当前节点的直接子节点集合

Fast.IaaS.CoordinateUtil

源码 · 目标:netstandard2.1

csharp
public static class CoordinateUtil

坐标工具类

说明:WGS-84:全球标准坐标系,常用于 GPS 定位GCJ-02:中国国测局坐标系,又称火星坐标系,国内地图(高德、腾讯、百度等)使用

Fast.IaaS.CoordinateUtil.IsInChina

源码 · 目标:netstandard2.1

csharp
public static bool IsInChina(double lat, double lng)

判断给定经纬度是否在中国境内 GCJ-02 偏移只在中国境内有效,境外坐标无需转换

  • 参数 lat:纬度
  • 参数 lng:经度
  • 返回:满足条件时返回 true;否则返回 false

Fast.IaaS.CoordinateUtil.WGS84ToGCJ02

源码 · 目标:netstandard2.1

csharp
public static (double lat, double lng) WGS84ToGCJ02(double wgLat, double wgLng)

WGS-84 -> GCJ-02(火星坐标)

说明:如果坐标在中国境外,则返回原坐标

  • 参数 wgLat:纬度
  • 参数 wgLng:经度
  • 返回:WGS-84 -> GCJ-02(火星坐标)

Fast.IaaS.CoordinateUtil.GCJ02ToWGS84

源码 · 目标:netstandard2.1

csharp
public static (double lat, double lng) GCJ02ToWGS84(double mgLat, double mgLng)

GCJ-02(火星坐标)-> WGS-84

说明:精确逆算比较复杂,这里使用迭代近似方法

  • 参数 mgLat:纬度
  • 参数 mgLng:经度
  • 返回:GCJ-02(火星坐标)-> WGS-84

Fast.IaaS.CryptoUtil

源码 · 目标:netstandard2.1

csharp
public static class CryptoUtil

加密解密工具类

Fast.IaaS.CryptoUtil.PemKeyPair

源码 · 目标:netstandard2.1

csharp
public sealed class PemKeyPair

使用 PKCS#8 私钥和 SubjectPublicKeyInfo 公钥表示的 PEM 密钥对

Fast.IaaS.CryptoUtil.PemKeyPair.PrivateKey

源码 · 目标:netstandard2.1

csharp
public string PrivateKey { get; }

未加密的 PKCS#8 PEM 私钥

Fast.IaaS.CryptoUtil.PemKeyPair.PublicKey

源码 · 目标:netstandard2.1

csharp
public string PublicKey { get; }

SubjectPublicKeyInfo PEM 公钥

Fast.IaaS.CryptoUtil.GenerateRandomBytes

源码 · 目标:netstandard2.1

csharp
public static byte[] GenerateRandomBytes(int length)

使用平台密码学随机数生成器生成安全随机字节

  • 参数 length:要生成的字节数,范围为 0 至 65,536
  • 返回:具有指定长度的新字节数组
  • 异常 ArgumentOutOfRangeExceptionlength 超出允许范围

Fast.IaaS.CryptoUtil.FixedTimeEquals

源码 · 目标:netstandard2.1

csharp
public static bool FixedTimeEquals(byte[] left, byte[] right)

以不按内容提前退出的方式比较两个字节数组

  • 参数 left:第一个字节数组
  • 参数 right:第二个字节数组
  • 返回:长度和所有字节均相同时返回 true

Fast.IaaS.CryptoUtil.MD5Encrypt

源码 · 目标:netstandard2.1

csharp
public static string MD5Encrypt(string content)

使用 MD5 算法计算字符串哈希

说明:仅用于非安全的普通校验,不得用于密码存储、签名或抗碰撞场景

  • 参数 content:要处理的内容
  • 返回:使用 MD5 算法计算字符串哈希

Fast.IaaS.CryptoUtil.SHA1Encrypt

源码 · 目标:netstandard2.1

csharp
public static string SHA1Encrypt(string str)

计算 SHA-1 哈希

说明:仅用于非安全的普通校验,不得用于密码存储、签名或抗碰撞场景

  • 参数 str:要处理的字符串
  • 返回:计算得到的 SHA-1 哈希

Fast.IaaS.CryptoUtil.SHA256Encrypt

源码 · 目标:netstandard2.1

csharp
public static string SHA256Encrypt(string content)

计算字符串的 SHA-256 哈希值

  • 参数 content:要处理的内容
  • 返回:计算得到的字符串的 SHA-256 哈希值

Fast.IaaS.CryptoUtil.SHA256Bytes

源码 · 目标:netstandard2.1

csharp
public static byte[] SHA256Bytes(string content)

计算 UTF-8 字符串的 32 字节 SHA-256 摘要

  • 参数 content:要计算摘要的 UTF-8 文本
  • 返回:32 字节 SHA-256 摘要

Fast.IaaS.CryptoUtil.SHA384Encrypt

源码 · 目标:netstandard2.1

csharp
public static string SHA384Encrypt(string content)

计算 UTF-8 字符串的 SHA-384 大写十六进制摘要

  • 参数 content:要计算摘要的 UTF-8 文本
  • 返回:96 个大写十六进制字符组成的 SHA-384 摘要

Fast.IaaS.CryptoUtil.SHA384Bytes

源码 · 目标:netstandard2.1

csharp
public static byte[] SHA384Bytes(string content)

计算 UTF-8 字符串的 48 字节 SHA-384 摘要

  • 参数 content:要计算摘要的 UTF-8 文本
  • 返回:48 字节 SHA-384 摘要

Fast.IaaS.CryptoUtil.SHA512Encrypt

源码 · 目标:netstandard2.1

csharp
public static string SHA512Encrypt(string content)

计算 UTF-8 字符串的 SHA-512 大写十六进制摘要

  • 参数 content:要计算摘要的 UTF-8 文本
  • 返回:128 个大写十六进制字符组成的 SHA-512 摘要

Fast.IaaS.CryptoUtil.SHA512Bytes

源码 · 目标:netstandard2.1

csharp
public static byte[] SHA512Bytes(string content)

计算 UTF-8 字符串的 64 字节 SHA-512 摘要

  • 参数 content:要计算摘要的 UTF-8 文本
  • 返回:64 字节 SHA-512 摘要

Fast.IaaS.CryptoUtil.HMACSHA256Encrypt

源码 · 目标:netstandard2.1

csharp
public static string HMACSHA256Encrypt(string content, string key)

使用 HMAC-SHA-256 认证 UTF-8 文本

  • 参数 content:要认证的 UTF-8 文本
  • 参数 key:非空的 UTF-8 HMAC 密钥
  • 返回:64 个小写十六进制字符组成的认证标签

Fast.IaaS.CryptoUtil.HMACSHA384Encrypt

源码 · 目标:netstandard2.1

csharp
public static string HMACSHA384Encrypt(string content, string key)

使用 HMAC-SHA-384 认证 UTF-8 文本

  • 参数 content:要认证的 UTF-8 文本
  • 参数 key:非空的 UTF-8 HMAC 密钥
  • 返回:96 个小写十六进制字符组成的认证标签

Fast.IaaS.CryptoUtil.HMACSHA512Encrypt

源码 · 目标:netstandard2.1

csharp
public static string HMACSHA512Encrypt(string content, string key)

使用 HMAC-SHA-512 认证 UTF-8 文本

  • 参数 content:要认证的 UTF-8 文本
  • 参数 key:非空的 UTF-8 HMAC 密钥
  • 返回:128 个小写十六进制字符组成的认证标签

Fast.IaaS.CryptoUtil.PBKDF2SHA256

源码 · 目标:netstandard2.1

csharp
public static byte[] PBKDF2SHA256(string password, byte[] salt, int iterations = DEFAULT_PBKDF2_ITERATIONS,
        int outputLength = 32)

使用 PBKDF2-HMAC-SHA-256 从 UTF-8 密码派生指定长度的密钥

说明:盐应由安全随机数生成器产生且至少 16 字节;派生结果不包含盐或迭代次数

  • 参数 password:1 至 1,024 UTF-8 字节的密码
  • 参数 salt:至少 8 字节的盐
  • 参数 iterations:PBKDF2 迭代次数,范围为 100,000 至 5,000,000
  • 参数 outputLength:派生密钥长度,范围为 1 至 1,024 字节
  • 返回:指定长度的派生密钥
  • 异常 ArgumentOutOfRangeException:密码、盐、迭代次数或输出长度超出允许范围

Fast.IaaS.CryptoUtil.HashPasswordPBKDF2SHA256

源码 · 目标:netstandard2.1

csharp
public static string HashPasswordPBKDF2SHA256(string password, int iterations = DEFAULT_PBKDF2_ITERATIONS)

使用随机盐生成可持久化的 PBKDF2-HMAC-SHA-256 密码哈希

  • 参数 password:1 至 1,024 UTF-8 字节的密码
  • 参数 iterations:PBKDF2 迭代次数,范围为 100,000 至 5,000,000
  • 返回:包含版本、迭代次数、16 字节随机盐和 32 字节派生密钥的自描述字符串
  • 异常 ArgumentOutOfRangeException:密码或迭代次数超出允许范围

Fast.IaaS.CryptoUtil.VerifyPasswordPBKDF2SHA256

源码 · 目标:netstandard2.1

csharp
public static bool VerifyPasswordPBKDF2SHA256(string password, string passwordHash)

验证 HashPasswordPBKDF2SHA256 生成的密码哈希

  • 参数 password:要验证的密码
  • 参数 passwordHash:自描述的 PBKDF2-HMAC-SHA-256 密码哈希
  • 返回:格式有效且密码匹配时返回 true;格式无效时返回 false

Fast.IaaS.CryptoUtil.HKDFSHA256

源码 · 目标:netstandard2.1

csharp
public static byte[] HKDFSHA256(byte[] inputKeyMaterial, byte[] salt = null, byte[] info = null, int outputLength = 32)

使用 RFC 5869 HKDF-SHA-256 派生上下文隔离的密钥材料

  • 参数 inputKeyMaterial:输入密钥材料,例如 ECDH 原始共享秘密
  • 参数 salt:可选盐;传入 null 时使用 32 个零字节
  • 参数 info:可选的应用和用途上下文
  • 参数 outputLength:输出长度,1 至 8,160 字节
  • 返回:指定长度、与 info 上下文绑定的派生密钥
  • 异常 ArgumentOutOfRangeExceptionoutputLength 超出 RFC 5869 限制

Fast.IaaS.CryptoUtil.AESEncrypt

源码 · 目标:netstandard2.1

csharp
public static string AESEncrypt(string dataStr, string key, string vector, CipherMode cipherMode = CipherMode.CBC,
        PaddingMode paddingMode = PaddingMode.PKCS7)

使用 AES 算法对给定字符串进行加密

说明:同一密钥重复使用固定 IV 会泄露明文模式;调用方应为不同数据提供不可预测且不重复的 IV

  • 参数 dataStr:要解析或处理的数据文本
  • 参数 key:用于加密的密钥。必须 32 位
  • 参数 vector:对称加密使用的初始化向量
  • 参数 cipherMode:对称加密使用的密码块模式
  • 参数 paddingMode:对称加密使用的填充模式
  • 返回:使用 AES 算法对给定字符串进行加密

Fast.IaaS.CryptoUtil.AESDecrypt

源码 · 目标:netstandard2.1

csharp
public static string AESDecrypt(string dataStr, string key, string vector, CipherMode cipherMode = CipherMode.CBC,
        PaddingMode paddingMode = PaddingMode.PKCS7)

使用 AES 算法对给定的 Base64 编码字符串进行解密

  • 参数 dataStr:要解析或处理的数据文本
  • 参数 key:用于解密的密钥。必须 32 位
  • 参数 vector:对称加密使用的初始化向量
  • 参数 cipherMode:对称加密使用的密码块模式
  • 参数 paddingMode:对称加密使用的填充模式
  • 返回:使用 AES 算法对给定的 Base64 编码字符串进行解密

Fast.IaaS.CryptoUtil.AESEncryptAuthenticated

源码 · 目标:netstandard2.1

csharp
public static string AESEncryptAuthenticated(string dataStr, string key)

使用 AES-GCM 加密并认证字符串

说明:此方法同时提供机密性和完整性;CBC/ECB 不具备认证能力

  • 参数 dataStr:要解析或处理的数据文本
  • 参数 key:密钥材料;内部使用 SHA-256 归一化为 256 位密钥
  • 返回:包含格式版本、随机 nonce、认证标签和密文的 Base64 字符串

Fast.IaaS.CryptoUtil.AESDecryptAuthenticated

源码 · 目标:netstandard2.1

csharp
public static string AESDecryptAuthenticated(string dataStr, string key)

解密并验证 AESEncryptAuthenticated 生成的字符串

  • 异常 CryptographicException:密钥错误、密文被篡改或格式不受支持
  • 参数 dataStr:要解析或处理的数据文本
  • 参数 key:加密时使用的密钥材料
  • 返回:解密并验证 AESEncryptAuthenticated 生成的字符串

Fast.IaaS.CryptoUtil.AESEncryptWithPassword

源码 · 目标:netstandard2.1

csharp
public static string AESEncryptWithPassword(string dataStr, string password, int iterations = DEFAULT_PBKDF2_ITERATIONS)

使用 PBKDF2-HMAC-SHA-256 派生 AES-256-GCM 密钥并认证加密 UTF-8 文本

说明:每次调用生成独立的 16 字节盐和 12 字节 nonce,结果与 TypeScript 工具的 aesEncryptWithPassword 格式完全一致

  • 参数 dataStr:UTF-8 编码后不超过 8 MiB 的明文
  • 参数 password:1 至 1,024 UTF-8 字节的密码
  • 参数 iterations:PBKDF2 迭代次数,默认 600,000
  • 返回:带版本、迭代次数、盐、nonce、密文和认证标签的自描述字符串

Fast.IaaS.CryptoUtil.AESDecryptWithPassword

源码 · 目标:netstandard2.1

csharp
public static string AESDecryptWithPassword(string payload, string password)

解密并认证 AESEncryptWithPassword 生成的跨语言载荷

  • 参数 payload:带版本、迭代次数、盐、nonce、密文和认证标签的载荷
  • 参数 password:加密时使用的密码
  • 返回:通过认证后的原始 UTF-8 明文
  • 异常 ArgumentOutOfRangeException:载荷或密码超过支持的长度
  • 异常 CryptographicException:密码错误、载荷被篡改或格式无效

Fast.IaaS.CryptoUtil.GenerateRSAKeyPair

源码 · 目标:netstandard2.1

csharp
public static PemKeyPair GenerateRSAKeyPair(int modulusLength = 2048)

生成可供 .NET 与 Web Crypto 互操作的 RSA PKCS#8/SPKI PEM 密钥对

  • 参数 modulusLength:RSA 模数位数,默认 2,048;必须至少为 2,048 且是 256 的倍数
  • 返回:未加密 PKCS#8 私钥和 SubjectPublicKeyInfo 公钥组成的 PEM 密钥对
  • 异常 ArgumentOutOfRangeExceptionmodulusLength 不符合安全边界

Fast.IaaS.CryptoUtil.RSAEncryptOAEP

源码 · 目标:netstandard2.1

csharp
public static string RSAEncryptOAEP(string dataStr, string publicKeyPem)

使用 RSA-OAEP/SHA-256 公钥加密 UTF-8 文本

  • 参数 dataStr:要加密的 UTF-8 文本;长度必须满足 RSA-OAEP 模数限制
  • 参数 publicKeyPem:SubjectPublicKeyInfo PEM 公钥
  • 返回:Base64 编码的 RSA 密文
  • 异常 CryptographicException:公钥格式无效或明文超过 RSA-OAEP 容量

Fast.IaaS.CryptoUtil.RSADecryptOAEP

源码 · 目标:netstandard2.1

csharp
public static string RSADecryptOAEP(string dataStr, string privateKeyPem)

使用 RSA-OAEP/SHA-256 私钥解密 Base64 密文

  • 参数 dataStr:Base64 编码的 RSA 密文
  • 参数 privateKeyPem:未加密的 PKCS#8 PEM 私钥
  • 返回:解密后的 UTF-8 文本
  • 异常 FormatExceptiondataStr 不是有效 Base64
  • 异常 CryptographicException:私钥格式无效、密钥不匹配或密文损坏

Fast.IaaS.CryptoUtil.RSASignPSS

源码 · 目标:netstandard2.1

csharp
public static string RSASignPSS(string dataStr, string privateKeyPem)

使用 RSA-PSS/SHA-256 私钥签名 UTF-8 文本

  • 参数 dataStr:要签名的 UTF-8 文本
  • 参数 privateKeyPem:未加密的 PKCS#8 PEM 私钥
  • 返回:Base64 编码的 RSA-PSS 签名;PSS 盐长度等于 SHA-256 摘要长度
  • 异常 CryptographicException:私钥格式无效或签名失败

Fast.IaaS.CryptoUtil.RSAVerifyPSS

源码 · 目标:netstandard2.1

csharp
public static bool RSAVerifyPSS(string dataStr, string signature, string publicKeyPem)

使用 RSA-PSS/SHA-256 公钥验证 Base64 签名

  • 参数 dataStr:签名时使用的 UTF-8 文本
  • 参数 signature:Base64 编码的 RSA-PSS 签名
  • 参数 publicKeyPem:SubjectPublicKeyInfo PEM 公钥
  • 返回:签名格式有效且与内容、公钥匹配时返回 true
  • 异常 FormatExceptionsignature 不是有效 Base64
  • 异常 CryptographicException:公钥格式无效

Fast.IaaS.CryptoUtil.GenerateECDSAKeyPair

源码 · 目标:netstandard2.1

csharp
public static PemKeyPair GenerateECDSAKeyPair(string namedCurve = "P-256")

生成 ECDSA PKCS#8/SPKI PEM 签名密钥对

  • 参数 namedCurve:NIST 曲线名称:P-256、P-384 或 P-521
  • 返回:未加密 PKCS#8 私钥和 SubjectPublicKeyInfo 公钥组成的 PEM 密钥对
  • 异常 ArgumentOutOfRangeExceptionnamedCurve 不受支持

Fast.IaaS.CryptoUtil.ECDSASign

源码 · 目标:netstandard2.1

csharp
public static string ECDSASign(string dataStr, string privateKeyPem, string namedCurve = "P-256")

使用 ECDSA 和曲线对应的 SHA-2 摘要签名 UTF-8 文本

说明:签名使用 IEEE P1363 固定字段拼接格式,与 Web Crypto 一致

  • 参数 dataStr:要签名的 UTF-8 文本
  • 参数 privateKeyPem:未加密的 EC PKCS#8 PEM 私钥
  • 参数 namedCurve:私钥使用的 NIST 曲线
  • 返回:Base64 编码的 IEEE P1363 ECDSA 签名
  • 异常 CryptographicException:私钥格式或曲线不匹配

Fast.IaaS.CryptoUtil.ECDSAVerify

源码 · 目标:netstandard2.1

csharp
public static bool ECDSAVerify(string dataStr, string signature, string publicKeyPem, string namedCurve = "P-256")

验证 Web Crypto 兼容的 ECDSA IEEE P1363 Base64 签名

  • 参数 dataStr:签名时使用的 UTF-8 文本
  • 参数 signature:Base64 编码的 IEEE P1363 ECDSA 签名
  • 参数 publicKeyPem:EC SubjectPublicKeyInfo PEM 公钥
  • 参数 namedCurve:公钥使用的 NIST 曲线
  • 返回:签名与内容、公钥和曲线匹配时返回 true
  • 异常 FormatExceptionsignature 不是有效 Base64
  • 异常 CryptographicException:公钥格式或曲线不匹配

Fast.IaaS.CryptoUtil.GenerateECDHKeyPair

源码 · 目标:netstandard2.1

csharp
public static PemKeyPair GenerateECDHKeyPair(string namedCurve = "P-256")

生成 ECDH PKCS#8/SPKI PEM 密钥协商密钥对

  • 参数 namedCurve:NIST 曲线名称:P-256、P-384 或 P-521
  • 返回:未加密 PKCS#8 私钥和 SubjectPublicKeyInfo 公钥组成的 PEM 密钥对
  • 异常 ArgumentOutOfRangeExceptionnamedCurve 不受支持

Fast.IaaS.CryptoUtil.DeriveECDHSecret

源码 · 目标:netstandard2.1

csharp
public static byte[] DeriveECDHSecret(string privateKeyPem, string publicKeyPem, string namedCurve = "P-256")

派生 ECDH 原始共享秘密

说明:原始秘密必须继续输入 HKDF 等 KDF,不得直接作为长期密钥

  • 参数 privateKeyPem:本方未加密的 EC PKCS#8 PEM 私钥
  • 参数 publicKeyPem:对方的 EC SubjectPublicKeyInfo PEM 公钥
  • 参数 namedCurve:双方密钥使用的 NIST 曲线
  • 返回:曲线字段长度的原始 ECDH 共享秘密
  • 异常 CryptographicException:密钥格式、曲线或密钥协商无效
  • 异常 PlatformNotSupportedException:运行时不支持原始 ECDH 密钥协商

Fast.IaaS.CryptoUtil.DeriveECDHKeySHA256

源码 · 目标:netstandard2.1

csharp
public static byte[] DeriveECDHKeySHA256(string privateKeyPem, string publicKeyPem, string namedCurve = "P-256")

使用 ECDH 后以 SHA-256 派生 32 字节共享密钥

说明:此方法直接调用平台 ECDH SHA-256 KDF,优先于直接使用原始共享秘密

  • 参数 privateKeyPem:本方未加密的 EC PKCS#8 PEM 私钥
  • 参数 publicKeyPem:对方的 EC SubjectPublicKeyInfo PEM 公钥
  • 参数 namedCurve:双方密钥使用的 NIST 曲线
  • 返回:32 字节共享密钥
  • 异常 CryptographicException:密钥格式、曲线或密钥协商无效

Fast.IaaS.DateTimeUtil

源码 · 目标:netstandard2.1

csharp
public static class DateTimeUtil

DateTime 工具类

Fast.IaaS.DateTimeUtil.GetYearMonthFirstDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetYearMonthFirstDay(string year, string month)

获取指定年月的第一天

  • 参数 year:年份
  • 参数 month:月份
  • 返回:DateTime 第一天的 DateTime

Fast.IaaS.DateTimeUtil.GetYearMonthFirstDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetYearMonthFirstDay(int year, int month)

获取指定年月的第一天

  • 参数 year:年份
  • 参数 month:月份
  • 返回:DateTime 第一天的 DateTime

Fast.IaaS.DateTimeUtil.GetYearMonthLastDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetYearMonthLastDay(string year, string month)

获取指定年月的最后一天

  • 参数 year:年份
  • 参数 month:月份
  • 返回:DateTime 最后一天的 DateTime

Fast.IaaS.DateTimeUtil.GetYearMonthLastDay

源码 · 目标:netstandard2.1

csharp
public static DateTime GetYearMonthLastDay(int year, int month)

获取指定年月的最后一天

  • 参数 year:年份
  • 参数 month:月份
  • 返回:DateTime 最后一天的 DateTime

Fast.IaaS.DateTimeUtil.DateDiffDay

源码 · 目标:netstandard2.1

csharp
public static int DateDiffDay(DateTime startTime, DateTime lastTime)

计算两个时间的差,返回天数

  • 参数 startTime:时间范围的开始时间
  • 参数 lastTime:上一次执行或记录的时间
  • 返回:计算得到的两个时间的差,返回天数

Fast.IaaS.FileUtil

源码 · 目标:netstandard2.1

csharp
public static class FileUtil

文件工具类

Fast.IaaS.FileUtil.GetFileSHA256

源码 · 目标:netstandard2.1

csharp
public static string GetFileSHA256(string filePath)

获取文件的 SHA-256 哈希值

  • 参数 filePath:file Path 路径
  • 返回:获取到的文件的 SHA-256 哈希值

Fast.IaaS.FileUtil.GetFileSHA1

源码 · 目标:netstandard2.1

csharp
public static string GetFileSHA1(string filePath)

获取文件的 SHA1 哈希值

  • 参数 filePath:file Path 路径
  • 返回:由小写字母组成的 SHA1 哈希值字符串

Fast.IaaS.FileUtil.CopyFile

源码 · 目标:netstandard2.1

csharp
public static void CopyFile(string fromPath, string toPath)

复制文件

  • 参数 fromPath:from Path 路径
  • 参数 toPath:to Path 路径

Fast.IaaS.FileUtil.TryCreateDirectory

源码 · 目标:netstandard2.1

csharp
public static void TryCreateDirectory(string path)

尝试创建文件夹

  • 参数 path:路径

Fast.IaaS.GuidUtil

源码 · 目标:netstandard2.1

csharp
public static class GuidUtil

Guid 工具类

Fast.IaaS.GuidUtil.GetGuid

源码 · 目标:netstandard2.1

csharp
public static string GetGuid(string format = "N")

生成一个 Guid

说明:只支持 N D B PN ece4f4a60b764339b94a07c84e338a27D 5bf99df1-dc49-4023-a34a-7bd80a42d6bbB 2280f8d7-fd18-4c72-a9ab-405de3fcfbc9P 25e6e09f-fb66-4cab-b4cd-bfb429566549

  • 参数 format:格式化方式
  • 返回:生成的一个 Guid

Fast.IaaS.GuidUtil.GetShortGuid

源码 · 目标:netstandard2.1

csharp
public static string GetShortGuid()

生成一个短的 Guid

  • 返回:生成的一个短的 Guid

Fast.IaaS.MaskingUtil

源码 · 目标:netstandard2.1

csharp
public static class MaskingUtil

数据脱敏工具类

Fast.IaaS.MaskingUtil.NameMasking

源码 · 目标:netstandard2.1

csharp
public static string NameMasking(string name)

姓名脱敏(只保留首字)

  • 参数 name:名称
  • 返回:姓名脱敏(只保留首字)

Fast.IaaS.MaskingUtil.NameKeepLastMasking

源码 · 目标:netstandard2.1

csharp
public static string NameKeepLastMasking(string name)

姓名脱敏(保留首尾)

  • 参数 name:名称
  • 返回:姓名脱敏(保留首尾)

Fast.IaaS.MaskingUtil.MobileMasking

源码 · 目标:netstandard2.1

csharp
public static string MobileMasking(string mobile)

手机号脱敏(152****5552)

  • 参数 mobile:要脱敏的手机号码
  • 返回:手机号脱敏(152****5552)

Fast.IaaS.MaskingUtil.IdCardMasking

源码 · 目标:netstandard2.1

csharp
public static string IdCardMasking(string idCard)

身份证脱敏处理(前 4 后 4)

  • 参数 idCard:要脱敏的身份证号码
  • 返回:身份证脱敏处理(前 4 后 4)

Fast.IaaS.MaskingUtil.EmailMasking

源码 · 目标:netstandard2.1

csharp
public static string EmailMasking(string email)

邮箱脱敏(最多保留 3 位字符 + 域名)

  • 参数 email:要脱敏的电子邮箱地址
  • 返回:邮箱脱敏(最多保留 3 位字符 + 域名)

Fast.IaaS.MaskingUtil.BankCardMasking

源码 · 目标:netstandard2.1

csharp
public static string BankCardMasking(string cardNo)

银行卡脱敏(前 6 后 4)

  • 参数 cardNo:要脱敏的银行卡号
  • 返回:银行卡脱敏(前 6 后 4)

Fast.IaaS.MaskingUtil.AddressMasking

源码 · 目标:netstandard2.1

csharp
public static string AddressMasking(string address)

地址脱敏(优先识别省/市/区/街道等行政区划,保留上级区域)

  • 参数 address:目标服务地址
  • 返回:地址脱敏(优先识别省/市/区/街道等行政区划,保留上级区域)

Fast.IaaS.MaskingUtil.CarNumberMasking

源码 · 目标:netstandard2.1

csharp
public static string CarNumberMasking(string carNumber)

车牌号脱敏(保留前两位,如有分隔符则保留“省份+地区字母+分隔符”)

  • 参数 carNumber:要验证的车牌号码
  • 返回:车牌号脱敏(保留前两位,如有分隔符则保留“省份+地区字母+分隔符”)

Fast.IaaS.MaskingUtil.IpMasking

源码 · 目标:netstandard2.1

csharp
public static string IpMasking(string ip)

IP 地址脱敏(保留前两段)

  • 参数 ip:要验证的 IP 地址
  • 返回:IP 地址脱敏(保留前两段)

Fast.IaaS.NumberUtil

源码 · 目标:netstandard2.1

csharp
public static class NumberUtil

序号工具类

Fast.IaaS.NumberUtil.IdToCodeByLong

源码 · 目标:netstandard2.1

csharp
public static string IdToCodeByLong(long id, int maxLength = 12)

将Id转换为 Base32 Crockford 字符串

  • 参数 id:要编码的Id
  • 参数 maxLength:目标长度
  • 返回:转换后的 Base32 Crockford 字符串

Fast.IaaS.RetryUtil

源码 · 目标:netstandard2.1

csharp
public sealed class RetryUtil

重试静态类

Fast.IaaS.RetryUtil.Invoke

源码 · 目标:netstandard2.1

csharp
public static void Invoke(Action action, int numRetries, int retryTimeout = 1000, bool finalThrow = true,
        Type[] exceptionTypes = null, Action<Exception> fallbackPolicy = null, Action<int, int> retryAction = null)

重试有异常的方法,还可以指定特定异常

  • 参数 action:要执行的操作委托
  • 参数 numRetries:最大重试次数
  • 参数 retryTimeout:两次重试之间的等待时间
  • 参数 finalThrow:重试耗尽后要抛出的异常工厂
  • 参数 exceptionTypes:允许触发重试的异常类型集合
  • 参数 fallbackPolicy:重试耗尽后使用的降级策略
  • 参数 retryAction:每次失败后执行的重试回调

Fast.IaaS.RetryUtil.InvokeAsync

源码 · 目标:netstandard2.1

csharp
public static async Task InvokeAsync(Func<Task> action, int numRetries, int retryTimeout = 1000, bool finalThrow = true,
        Type[] exceptionTypes = null, Func<Exception, Task> fallbackPolicy = null, Func<int, int, Task> retryAction = null,
        CancellationToken cancellationToken = default)

重试有异常的方法,还可以指定特定异常

  • 参数 action:要执行的操作委托
  • 参数 numRetries:最大重试次数
  • 参数 retryTimeout:两次重试之间的等待时间
  • 参数 finalThrow:重试耗尽后要抛出的异常工厂
  • 参数 exceptionTypes:允许触发重试的异常类型集合
  • 参数 fallbackPolicy:重试耗尽后使用的降级策略
  • 参数 retryAction:每次失败后执行的重试回调
  • 参数 cancellationToken:用于取消异步操作的令牌
  • 返回:表示异步“重试有异常的方法,还可以指定特定异常”操作的任务

Fast.IaaS.TreeBuildUtil

源码 · 目标:netstandard2.1

csharp
public class TreeBuildUtil<TEntity, TProperty> where TEntity : ITreeNode<TProperty>
    where TProperty : struct, IComparable, IConvertible, IFormattable

递归工具类,用于遍历有父子关系的节点,例如菜单树,字典树等等

  • 类型参数 TEntity:实体类型
  • 类型参数 TProperty:属性值类型

Fast.IaaS.TreeBuildUtil.SetRootParentId

源码 · 目标:netstandard2.1

csharp
public void SetRootParentId(TProperty rootParentId)

设置构建树时使用的根节点父级标识

  • 参数 rootParentId:顶级节点应匹配的父级标识;默认为 default

Fast.IaaS.TreeBuildUtil.Build

源码 · 目标:netstandard2.1

csharp
public List<TEntity> Build(List<TEntity> nodes)

构造树节点

  • 参数 nodes:要构建为树的节点集合
  • 返回:构造树节点集合

Fast.IaaS.VerificationUtil

源码 · 目标:netstandard2.1

csharp
public static class VerificationUtil

验证工具类

Fast.IaaS.VerificationUtil.IdToCodeByLong

源码 · 目标:netstandard2.1

csharp
public static string IdToCodeByLong(long id)

将Id转换为邀请码

  • 参数 id:唯一标识
  • 返回:转换后的邀请码

Fast.IaaS.VerificationUtil.CodeToIdByLong

源码 · 目标:netstandard2.1

csharp
public static long CodeToIdByLong(string code)

从邀请码解析Id

  • 参数 code:业务或枚举编码
  • 返回:解析得到的Id

Fast.IaaS.VerificationUtil.IdToCodeByInt

源码 · 目标:netstandard2.1

csharp
public static string IdToCodeByInt(int id)

将Id转换为邀请码

  • 参数 id:唯一标识
  • 返回:转换后的邀请码

Fast.IaaS.VerificationUtil.CodeToIdByInt

源码 · 目标:netstandard2.1

csharp
public static int CodeToIdByInt(string code)

从邀请码解析Id

  • 参数 code:业务或枚举编码
  • 返回:解析得到的Id

Fast.IaaS.VerificationUtil.PrintBase

源码 · 目标:netstandard2.1

csharp
public static string PrintBase()

显示用于进制编码的所有字符串

  • 返回:显示用于进制编码的所有字符串

Fast.IaaS.VerificationUtil.GenNumVerCode

源码 · 目标:netstandard2.1

csharp
public static string GenNumVerCode(int len = CODE_LEN)

生成数字验证码

  • 参数 len:目标长度
  • 返回:生成的数字验证码

Fast.IaaS.VerificationUtil.GenStrVerCode

源码 · 目标:netstandard2.1

csharp
public static string GenStrVerCode(int len = CODE_LEN)

生成字符串验证码

  • 参数 len:目标长度
  • 返回:生成的字符串验证码

Fast.IaaS.VerificationUtil.GenRandomNum

源码 · 目标:netstandard2.1

csharp
public static int GenRandomNum(int minVal, int maxVal, bool isInclude = false)

生成随机数

  • 参数 minVal:允许的最小值
  • 参数 maxVal:允许的最大值
  • 参数 isInclude:边界值是否包含在有效范围内
  • 返回:生成的随机数