Skip to content

Fast.IaaS public API

Targets: netstandard2.1. This is a declaration and XML-comment reference. See the module guide for usage and constraints.

Source commit: 43554c07f6c216f80b509bd535c0a5b66ae7f2e8. Maintained through scripts/export-dotnet-api.ps1 -Language en; ordinary site builds consume this file directly.

Fast.IaaS.EnumItem

Source · Targets: netstandard2.1

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

Enum item

  • Type parameter TProperty: Type of the Value property

Fast.IaaS.EnumItem.Describe

Source · Targets: netstandard2.1

csharp
public string Describe { set; get; }

Enum description

Fast.IaaS.EnumItem.Name

Source · Targets: netstandard2.1

csharp
public string Name { set; get; }

Enum name

Fast.IaaS.EnumItem.Value

Source · Targets: netstandard2.1

csharp
public TProperty Value { set; get; }

Enum object value

Fast.IaaS.GlobalConstant

Source · Targets: netstandard2.1

csharp
public static class GlobalConstant

Common constants

Fast.IaaS.GlobalConstant.DefaultTime

Source · Targets: netstandard2.1

csharp
public static DateTime DefaultTime { get; }

Default DateTime

Fast.IaaS.GlobalConstant.TimeStamp

Source · Targets: netstandard2.1

csharp
public static long TimeStamp { get; }

Timestamp

Fast.IaaS.GlobalConstant.SqlServerMinTime

Source · Targets: netstandard2.1

csharp
public static DateTime SqlServerMinTime { get; }

Minimum SQL Server date/time

Fast.IaaS.GlobalConstant.SqlServerMaxTime

Source · Targets: netstandard2.1

csharp
public static DateTime SqlServerMaxTime { get; }

Maximum SQL Server date/time

Fast.IaaS.GlobalConstant.SpecialSplitSymbol

Source · Targets: netstandard2.1

csharp
public static char SpecialSplitSymbol { get; }

Special delimiter

Fast.IaaS.GlobalConstant.SpecialMarkSymbol

Source · Targets: netstandard2.1

csharp
public static char SpecialMarkSymbol { get; }

Special marker

Fast.IaaS.AssemblyExtension

Source · Targets: netstandard2.1

csharp
public static class AssemblyExtension

Extensions for Assembly

Fast.IaaS.AssemblyExtension.GetTypes

Source · Targets: netstandard2.1

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

Gets all types

  • Parameter assembly: Target assembly
  • Parameter exported: Whether to return exported types only
  • Returns: The collection of discovered types

Fast.IaaS.AssemblyExtension.GetDescription

Source · Targets: netstandard2.1

csharp
public static string GetDescription(this Assembly assembly)

Gets the assembly description

  • Parameter assembly: Target assembly
  • Returns: The assembly description

Fast.IaaS.AssemblyExtension.GetVersion

Source · Targets: netstandard2.1

csharp
public static Version GetVersion(this Assembly assembly)

Gets the assembly version

  • Parameter assembly: Target assembly
  • Returns: The assembly version

Fast.IaaS.AssemblyExtension.GetAssemblyName

Source · Targets: netstandard2.1

csharp
public static string GetAssemblyName(this Assembly assembly)

Gets the assembly name

  • Parameter assembly: Target assembly
  • Returns: The assembly name

Fast.IaaS.AssemblyExtension.GetType

Source · Targets: netstandard2.1

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

Gets a runtime type from an assembly and fully qualified type name

  • Parameter assembly: Target assembly
  • Parameter typeFullName: Fully qualified target type name
  • Returns: Gets a runtime type from an assembly and fully qualified type name

Fast.IaaS.Base64Extension

Source · Targets: netstandard2.1

csharp
public static class Base64Extension

Base64 extensions

Fast.IaaS.Base64Extension.RandomPrefixStrLength = 6

Source · Targets: netstandard2.1

csharp
public const int RandomPrefixStrLength = 6;

Random character length

Fast.IaaS.Base64Extension.ToBase64

Source · Targets: netstandard2.1

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

Converts an ordinary string to a Base64 string

  • Parameter str: String to process
  • Parameter randomPrefixStrLength: Number of characters in the random prefix
  • Returns: Converts an ordinary string to a Base64 string

Fast.IaaS.Base64Extension.Base64ToString

Source · Targets: netstandard2.1

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

Converts a Base64 string to an ordinary string

  • Parameter base64Str: Base64 text to decode
  • Parameter randomPrefixStrLength: Number of characters in the random prefix
  • Returns: Converts a Base64 string to an ordinary string

Fast.IaaS.ConvertExtension

Source · Targets: netstandard2.1

csharp
public static class ConvertExtension

Conversion extensions for Convert

Fast.IaaS.ConvertExtension.ParseToLong

Source · Targets: netstandard2.1

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

Converts String to Long

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Fallback value on error; defaults to 0L
  • Returns: Converts String to Long

Fast.IaaS.ConvertExtension.ParseToLong

Source · Targets: netstandard2.1

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

Converts Enum to Long

  • Throws ArgumentNullException: The supplied enum value is null
  • Parameter value: Enum value
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Fallback value on error; defaults to 0L
  • Type parameter TEnum: Enum type
  • Returns: Converts Enum to Long

Fast.IaaS.ConvertExtension.ParseToLong

Source · Targets: netstandard2.1

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

Converts a nullable Enum to Long

  • Throws ArgumentNullException: The supplied enum value is null
  • Parameter value: Enum value
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Fallback value on error; defaults to 0L
  • Type parameter TEnum: Enum type
  • Returns: Converts a nullable Enum to Long

Fast.IaaS.ConvertExtension.ParseToInt

Source · Targets: netstandard2.1

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

Converts String to Int

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Default value used when the operation cannot produce a result
  • Returns: Converts String to Int

Fast.IaaS.ConvertExtension.ParseToInt

Source · Targets: netstandard2.1

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

Converts Enum to Int

  • Throws ArgumentNullException: The supplied enum value is null
  • Parameter value: Enum value
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Default value used when the operation cannot produce a result
  • Type parameter TEnum: Enum type
  • Returns: Converts Enum to Int

Fast.IaaS.ConvertExtension.ParseToInt

Source · Targets: netstandard2.1

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

Converts a nullable Enum to Int

  • Throws ArgumentNullException: The supplied enum value is null
  • Parameter value: Enum value
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Default value used when the operation cannot produce a result
  • Type parameter TEnum: Enum type
  • Returns: Converts a nullable Enum to Int

Fast.IaaS.ConvertExtension.ParseToShort

Source · Targets: netstandard2.1

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

Converts String to Short

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Short fallback value on error; defaults to 0
  • Returns: Converts String to Short

Fast.IaaS.ConvertExtension.ParseToDecimal

Source · Targets: netstandard2.1

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

Converts String to Decimal

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Decimal fallback value on error; defaults to 0M
  • Returns: Converts String to Decimal

Fast.IaaS.ConvertExtension.ParseToBool

Source · Targets: netstandard2.1

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

Converts String to Bool

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Fallback value on error; defaults to false
  • Returns: The parsed Boolean value; returns defaultValue for invalid input when exceptions are disabled

Fast.IaaS.ConvertExtension.ParseToFloat

Source · Targets: netstandard2.1

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

Converts String to Float

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Float fallback value on error; defaults to 0F
  • Returns: Converts String to Float

Fast.IaaS.ConvertExtension.ParseToDouble

Source · Targets: netstandard2.1

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

Converts String to Float

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Double fallback value on error; defaults to 0D
  • Returns: Converts String to Float

Fast.IaaS.ConvertExtension.ParseToGuid

Source · Targets: netstandard2.1

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

Converts String to Guid

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: Guid fallback value on error; defaults to Guid.Empty
  • Returns: Converts String to Guid

Fast.IaaS.ConvertExtension.ParseToDateTime

Source · Targets: netstandard2.1

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

Converts String to DateTime

  • Throws ArgumentNullException: The supplied value is null or an empty string
  • Parameter value: Value to convert
  • Parameter isThrow: Whether to throw an exception on failure
  • Parameter defaultValue: DateTime fallback value on error; defaults to DateTime.MinValue
  • Returns: Converts String to DateTime

Fast.IaaS.ConvertExtension.ParseToDateTime

Source · Targets: netstandard2.1

csharp
public static DateTime ParseToDateTime(this DateTimeOffset dateTime)

Converts DateTimeOffset to local DateTime

  • Parameter dateTime: Date/time to process
  • Returns: Converts DateTimeOffset to local DateTime

Fast.IaaS.ConvertExtension.ParseToDateTime

Source · Targets: netstandard2.1

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

Converts DateTimeOffset? to local DateTime

  • Parameter dateTime: Date/time to process
  • Returns: Converts DateTimeOffset? to local DateTime

Fast.IaaS.ConvertExtension.ParseToDateTimeOffset

Source · Targets: netstandard2.1

csharp
public static DateTimeOffset ParseToDateTimeOffset(this DateTime dateTime)

Converts DateTime to DateTimeOffset

  • Parameter dateTime: Date/time to process
  • Returns: Converts DateTime to DateTimeOffset

Fast.IaaS.ConvertExtension.ParseToDateTimeOffset

Source · Targets: netstandard2.1

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

Converts DateTime? to DateTimeOffset

  • Parameter dateTime: Date/time to process
  • Returns: Converts DateTime? to DateTimeOffset

Fast.IaaS.ConvertExtension.ParseToDateTime_Milliseconds

Source · Targets: netstandard2.1

csharp
public static DateTime ParseToDateTime_Milliseconds(this long timeStamps)

Converts a millisecond timestamp to DateTime. Returns the minimum date on failure without throwing.

  • Parameter timeStamps: Timestamp collection
  • Returns: Converts a millisecond timestamp to DateTime. Returns the minimum date on failure without throwing.

Fast.IaaS.ConvertExtension.ParseToDateTime_Milliseconds

Source · Targets: netstandard2.1

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

Converts a millisecond timestamp to DateTime, returning the default value on failure

  • Parameter timeStamps: Timestamp collection
  • Parameter defaultValue: Default value returned when the timestamp is 0 or conversion fails
  • Returns: Converts a millisecond timestamp to DateTime, returning the default value on failure

Fast.IaaS.ConvertExtension.ParseToDateTime_Seconds

Source · Targets: netstandard2.1

csharp
public static DateTime ParseToDateTime_Seconds(this long timeStamps)

Converts a timestamp in seconds to DateTime. Returns the minimum date on failure without throwing.

  • Parameter timeStamps: Timestamp collection
  • Returns: Converts a timestamp in seconds to DateTime. Returns the minimum date on failure without throwing.

Fast.IaaS.ConvertExtension.ParseToDateTime_Seconds

Source · Targets: netstandard2.1

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

Converts a timestamp in seconds to DateTime, returning the default value on failure

  • Parameter timeStamps: Timestamp collection
  • Parameter defaultValue: Default value returned when the timestamp is 0 or conversion fails
  • Returns: Converts a timestamp in seconds to DateTime, returning the default value on failure

Fast.IaaS.ConvertExtension.ParseToUnixTime

Source · Targets: netstandard2.1

csharp
public static long ParseToUnixTime(this DateTime dateTime)

Converts DateTime to UnixTime

  • Parameter dateTime: Date/time to process
  • Returns: Converts DateTime to UnixTime

Fast.IaaS.ConvertExtension.CastSuper

Source · Targets: netstandard2.1

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

Casts the value to a type

  • Parameter source: Source object
  • Type parameter TResult: Operation result type
  • Returns: Casts a collection to a type

Fast.IaaS.DataTableExtension

Source · Targets: netstandard2.1

csharp
public static class DataTableExtension

Extensions for DataTable

Fast.IaaS.DataTableExtension.ToDataTable

Source · Targets: netstandard2.1

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

Converts to DataTable

  • Parameter data: Data to process or transmit
  • Type parameter T: Model type corresponding to each data table row
  • Returns: The converted DataTable

Fast.IaaS.DataTableExtension.ToList

Source · Targets: netstandard2.1

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

DataTable To List

  • Parameter dataTable: Data table to convert
  • Type parameter T: Model type corresponding to each data table row
  • Returns: Converts DataTable to a List

Fast.IaaS.DateTimeExtension

Source · Targets: netstandard2.1

csharp
public static class DateTimeExtension

Extensions for DateTime

Fast.IaaS.DateTimeExtension.GetSayHello

Source · Targets: netstandard2.1

csharp
public static string GetSayHello(this DateTime dateTime)

Gets a greeting

  • Parameter dateTime: Date/time to process
  • Returns: Gets a greeting

Fast.IaaS.DateTimeExtension.GetCurMonthFirstDay

Source · Targets: netstandard2.1

csharp
public static DateTime GetCurMonthFirstDay(this DateTime dateTime)

Gets the first day of the current month

  • Parameter dateTime: Date/time to process
  • Returns: The first day of the current month

Fast.IaaS.DateTimeExtension.GetCurMonthLastDay

Source · Targets: netstandard2.1

csharp
public static DateTime GetCurMonthLastDay(this DateTime dateTime)

Gets the last day of the current month

  • Parameter dateTime: Date/time to process
  • Returns: The last day of the current month

Fast.IaaS.DateTimeExtension.GetUpMonthFirstDay

Source · Targets: netstandard2.1

csharp
public static DateTime GetUpMonthFirstDay(this DateTime dateTime)

Gets the first day of the previous month

  • Parameter dateTime: Date/time to process
  • Returns: The first day of the previous month

Fast.IaaS.DateTimeExtension.GetUpMonthLastDay

Source · Targets: netstandard2.1

csharp
public static DateTime GetUpMonthLastDay(this DateTime dateTime)

Gets the last day of the previous month

  • Parameter dateTime: Date/time to process
  • Returns: The last day of the previous month

Fast.IaaS.DateTimeExtension.GetCurWeekDay

Source · Targets: netstandard2.1

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

Gets the current week's time range

  • Parameter dateTime: Date/time to process
  • Returns: Start and end of the time range

Fast.IaaS.DateTimeExtension.GetUpWeekDay

Source · Targets: netstandard2.1

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

Gets the previous week's time range

  • Parameter dateTime: Date/time to process
  • Returns: Start and end of the time range

Fast.IaaS.DateTimeExtension.GetCurDay

Source · Targets: netstandard2.1

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

Gets today's time range

  • Parameter dateTime: Date/time to process
  • Returns: Start and end of the time range

Fast.IaaS.DateTimeExtension.GetUpDay

Source · Targets: netstandard2.1

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

Gets yesterday's time range

  • Parameter dateTime: Date/time to process
  • Returns: Start and end of the time range

Fast.IaaS.DateTimeExtension.GetZodiac

Source · Targets: netstandard2.1

csharp
public static string GetZodiac(this DateTime dateTime)

Gets the Chinese zodiac sign

  • Parameter dateTime: Date/time to process
  • Returns: The Chinese zodiac sign

Fast.IaaS.DateTimeExtension.GetConstellation

Source · Targets: netstandard2.1

csharp
public static string GetConstellation(this DateTime dateTime)

Gets the Western zodiac sign

  • Parameter dateTime: Date/time to process
  • Returns: The Western zodiac sign

Fast.IaaS.DateTimeExtension.GetLifeCode

Source · Targets: netstandard2.1

csharp
public static int GetLifeCode(this DateTime dateTime)

Life path number

  • Parameter dateTime: Date/time to process
  • Returns: Life path number

Fast.IaaS.DecimalExtension

Source · Targets: netstandard2.1

csharp
public static class DecimalExtension

Extensions for decimal

Fast.IaaS.DecimalExtension.GetPercentage

Source · Targets: netstandard2.1

csharp
public static string GetPercentage(this decimal data)

Gets a percentage

  • Parameter data: Data to process or transmit
  • Returns: Gets a percentage

Fast.IaaS.DecimalExtension.GetPercentage

Source · Targets: netstandard2.1

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

Gets a percentage

  • Parameter num1: First numeric operand
  • Parameter num2: Second numeric operand
  • Returns: Gets a percentage

Fast.IaaS.DecimalExtension.GetDecimal

Source · Targets: netstandard2.1

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

Gets a decimal while retaining its fractional digits

  • Parameter data: Data to process or transmit
  • Parameter places: Number of decimal places to retain
  • Returns: The decimal with its fractional digits retained

Fast.IaaS.EnumExtension

Source · Targets: netstandard2.1

csharp
public static class EnumExtension

Extensions for Enum

Fast.IaaS.EnumExtension.GetDescription

Source · Targets: netstandard2.1

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

Gets the description of an enum value

Remarks: Requires a [Description] attribute; otherwise returns the enum value's Name

  • Throws ArgumentNullException: The supplied enum value is null
  • Throws ArgumentException: The parameter is not an enum type
  • Parameter value: Name or numeric value to convert to an enum
  • Type parameter TEnum: Enum type
  • Returns: Description from the enum's [Description] attribute

Fast.IaaS.EnumExtension.GetDescription

Source · Targets: netstandard2.1

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

Gets the description of an enum value

Remarks: Requires a [Description] attribute; otherwise returns the enum value's Name

  • Throws ArgumentNullException: The supplied enum value is null
  • Throws ArgumentException: The parameter is not an enum type
  • Parameter value: Enum value
  • Parameter enumType: Enum type
  • Returns: Description from the enum's [Description] attribute

Fast.IaaS.EnumExtension.EnumToList

Source · Targets: netstandard2.1

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

Converts an enum to a collection of enum information

  • Throws ArgumentException: The type is not an enum type
  • Parameter enumType: Enum type
  • Returns: The collection of enum information

Fast.IaaS.EnumExtension.EnumToList

Source · Targets: netstandard2.1

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

Converts an enum to a collection of enum information

  • Throws ArgumentException: The type is not an enum type
  • Parameter enumType: Enum type
  • Type parameter TProperty: Property value type
  • Returns: The collection of enum information

Fast.IaaS.FieldInfoExtension

Source · Targets: netstandard2.1

csharp
public static class FieldInfoExtension

Extensions for FieldInfo

Fast.IaaS.FieldInfoExtension.GetDescriptionValue

Source · Targets: netstandard2.1

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

Gets a field attribute

  • Parameter field: Target field
  • Type parameter T: Attribute type to read
  • Returns: The field attribute

Fast.IaaS.GroupByExtension

Source · Targets: netstandard2.1

csharp
public static class GroupByExtension

GroupBy extensions for EnumExtension

Fast.IaaS.GroupByExtension.GroupByMultiple

Source · Targets: netstandard2.1

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

Groups by multiple keys

  • Parameter source: Source object
  • Parameter groupByProperties: Property names used for grouping
  • Type parameter TKey: Key type
  • Returns: The collection grouped by multiple keys

Fast.IaaS.IDictionaryExtension

Source · Targets: netstandard2.1

csharp
public static class IDictionaryExtension

Extensions for IDictionary{TKey,TValue}

Fast.IaaS.IDictionaryExtension.ToQueryString

Source · Targets: netstandard2.1

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

Converts a dictionary to a query string

  • Parameter dict: Dictionary to process
  • Parameter urlEncode: Whether to URL-encode the generated query string
  • Parameter isToLower: Whether to lowercase the first character of each name
  • Returns: Converts a dictionary to a query string

Fast.IaaS.IDictionaryExtension.RemoveEmptyValueItems

Source · Targets: netstandard2.1

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

Removes entries with null values

  • Parameter dict: IDictionary

Fast.IaaS.IDictionaryExtension.AddOrUpdate

Source · Targets: netstandard2.1

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

Adds or updates an entry

  • Parameter dictionary: IDictionary
  • Parameter key: Dictionary key
  • Parameter value: Dictionary value to add or replace
  • Type parameter TKey: Dictionary key type
  • Type parameter TValue: Dictionary value type

Fast.IaaS.IDictionaryExtension.AddOrUpdate

Source · Targets: netstandard2.1

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

Adds or updates an entry

  • Parameter dictionary: IDictionary
  • Parameter concatDictionary: Data to merge into the current dictionary
  • Type parameter TKey: Dictionary key type
  • Type parameter TValue: Dictionary value type

Fast.IaaS.IDictionaryExtension.AddOrUpdate

Source · Targets: netstandard2.1

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

Adds or updates an entry

  • Parameter dictionary: IDictionary
  • Parameter concatDictionary: Data to merge into the current dictionary
  • Type parameter TKey: Dictionary key type
  • Type parameter TValue: Dictionary value type

Fast.IaaS.IDictionaryExtension.AddOrUpdate

Source · Targets: netstandard2.1

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

Merges two dictionaries

  • Parameter dic: IDictionary{TKey,TValue} dictionary
  • Parameter newDic: New IDictionary{TKey,TValue} dictionary
  • Type parameter T: Type of dictionary values
  • Returns: IDictionary

Fast.IaaS.IDictionaryExtension.DicToXmlStr

Source · Targets: netstandard2.1

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

Converts a dictionary to a string

  • Parameter dic: IDictionary
  • Returns: Converts a dictionary to a string

Fast.IaaS.IDictionaryExtension.XmlStrToDic

Source · Targets: netstandard2.1

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

Converts a string to a dictionary

  • Parameter xml: XML text to parse
  • Returns: IDictionary

Fast.IaaS.IDictionaryExtension.SortDicToXmlStr

Source · Targets: netstandard2.1

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

Converts a dictionary to a string

  • Parameter dic: IDictionary
  • Returns: Converts a dictionary to a string

Fast.IaaS.IDictionaryExtension.XmlStrToSortDic

Source · Targets: netstandard2.1

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

Converts a string to a dictionary

  • Parameter xml: XML text to parse
  • Returns: SortedDictionary

Fast.IaaS.LinqExpressionExtension

Source · Targets: netstandard2.1

csharp
public static class LinqExpressionExtension

Extensions for Expression

Fast.IaaS.LinqExpressionExtension.GetPropertyName

Source · Targets: netstandard2.1

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

Resolves the selected property name from an expression

  • Throws ArgumentException: Expression is not valid for property selection
  • Parameter propertySelector: Expression selecting the target property
  • Type parameter T: Object type represented by the expression parameter
  • Type parameter TProperty: Property value type
  • Returns: The resolved property name

Fast.IaaS.LinqExpressionExtension.GetPropertyName

Source · Targets: netstandard2.1

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

Resolves the selected property name from an expression

  • Throws ArgumentException: Invalid property selection
  • Parameter memberExpression: Expression used to resolve the property name
  • Type parameter T: Object type represented by the expression parameter
  • Returns: The resolved property name

Fast.IaaS.MethodInfoExtension

Source · Targets: netstandard2.1

csharp
public static class MethodInfoExtension

Extensions for MethodInfo

Fast.IaaS.MethodInfoExtension.IsAsync

Source · Targets: netstandard2.1

csharp
public static bool IsAsync(this MethodInfo methodInfo)

Checks whether a method is asynchronous

  • Parameter methodInfo: Reflection metadata for the target method
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.MethodInfoExtension.GetRealReturnType

Source · Targets: netstandard2.1

csharp
public static Type GetRealReturnType(this MethodInfo methodInfo)

Gets the method's underlying return type

  • Parameter methodInfo: Reflection metadata for the target method
  • Returns: The method's underlying return type

Fast.IaaS.MethodInfoExtension.GetFoundAttribute

Source · Targets: netstandard2.1

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

Finds the specified attribute on the method, then on its declaring class if absent

  • Parameter methodInfo: Reflection metadata for the target method
  • Parameter inherit: Whether to continue searching base types for members or attributes
  • Type parameter TAttribute: Attribute type to find
  • Returns: Finds the specified attribute on the method, then on its declaring class if absent

Fast.IaaS.MethodInfoExtension.GetFoundAttribute

Source · Targets: netstandard2.1

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

Finds the specified attribute on the method, then on its declaring class if absent

  • Parameter methodInfo: Reflection metadata for the target method
  • Parameter attributeType: Attribute type to read
  • Parameter inherit: Whether to continue searching base types for members or attributes
  • Returns: Finds the specified attribute on the method, then on its declaring class if absent

Fast.IaaS.MethodInfoExtension.GetMethodParameterCount

Source · Targets: netstandard2.1

csharp
public static int GetMethodParameterCount(this MethodInfo methodInfo)

Gets the number of method parameters

  • Parameter methodInfo: Reflection metadata for the target method
  • Returns: Number of matching items

Fast.IaaS.ObjectExtension

Source · Targets: netstandard2.1

csharp
public static class ObjectExtension

Extensions for object

Fast.IaaS.ObjectExtension.ChangeType

Source · Targets: netstandard2.1

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

Converts an object to the specified type

  • Parameter obj: Object to process
  • Parameter type: Target type
  • Returns: Converts an object to the specified type

Fast.IaaS.ObjectExtension.ToDictionary

Source · Targets: netstandard2.1

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

Converts an object to a dictionary

  • Parameter obj: Object to process
  • Parameter includeNull: Whether to include properties with null values
  • Returns: IDictionary

Fast.IaaS.ObjectExtension.ChangeType

Source · Targets: netstandard2.1

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

Converts an object to the specified type

  • Parameter obj: Object to process
  • Type parameter T: Object type used for conversion
  • Returns: Converts an object to the specified type

Fast.IaaS.ObjectExtension.ToQueryString

Source · Targets: netstandard2.1

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

Converts public object properties to a query string

Remarks: String and integer lists use repeated query parameters with [] suffixes; other complex properties use their string representation

  • Parameter obj: Object to convert
  • Parameter isToLower: Whether to lowercase the first character of property names
  • Returns: A query string of non-null public properties; an empty object returns an empty string

Fast.IaaS.ObjectExtension.TryGetCount

Source · Targets: netstandard2.1

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

Attempts to get the object's count

  • Parameter obj: Object to process
  • Parameter count: The resulting element count
  • Returns: Returns true when a count can be read from a character, string, collection or public Count property; otherwise false

Fast.IaaS.StringEncodingExtension

Source · Targets: netstandard2.1

csharp
public static class StringEncodingExtension

String encoding extensions

Fast.IaaS.StringEncodingExtension.EnAscii

Source · Targets: netstandard2.1

csharp
public static string EnAscii(this string str)

Converts a string to an ASCII-encoded representation

  • Parameter str: String to process
  • Returns: The ASCII-encoded string representation

Fast.IaaS.StringEncodingExtension.DeAscii

Source · Targets: netstandard2.1

csharp
public static string DeAscii(this string str)

Converts an ASCII-encoded representation to a string

  • Parameter str: String to process
  • Returns: Converts an ASCII-encoded representation to a string

Fast.IaaS.StringEncodingExtension.EnUnicode

Source · Targets: netstandard2.1

csharp
public static string EnUnicode(this string str)

Unicode encoding

  • Parameter str: String to process
  • Returns: Unicode encoding

Fast.IaaS.StringEncodingExtension.DeUnicode

Source · Targets: netstandard2.1

csharp
public static string DeUnicode(this string str)

Unicode decoding

  • Parameter str: String to process
  • Returns: Unicode decoding

Fast.IaaS.StringEncodingExtension.UrlEncode

Source · Targets: netstandard2.1

csharp
public static string UrlEncode(this string str)

URL-encodes a string; an already encoded string is left unchanged

  • Parameter str: String to encode
  • Returns: The URL-encoded string; empty input returns an empty string

Fast.IaaS.StringEncodingExtension.UrlDecode

Source · Targets: netstandard2.1

csharp
public static string UrlDecode(this string str)

Decodes URL-encoded text to a string

  • Parameter str: String to process
  • Returns: Decodes URL-encoded text to a string

Fast.IaaS.StringExtension

Source · Targets: netstandard2.1

csharp
public static class StringExtension

Extensions for string

Fast.IaaS.StringExtension.FirstCharToUpper

Source · Targets: netstandard2.1

csharp
public static string FirstCharToUpper(this string str)

Uppercases the first character of a string

  • Parameter str: String to process
  • Returns: Uppercases the first character of a string

Fast.IaaS.StringExtension.FirstCharToLower

Source · Targets: netstandard2.1

csharp
public static string FirstCharToLower(this string str)

Lowercases the first character of a string

  • Parameter str: String to process
  • Returns: Lowercases the first character of a string

Fast.IaaS.StringExtension.SplitCamelCase

Source · Targets: netstandard2.1

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

Splits a camel-cased string

  • Parameter str: String to process
  • Returns: The split parts of the camel-cased string

Fast.IaaS.StringExtension.ToCamelCase

Source · Targets: netstandard2.1

csharp
public static string ToCamelCase(this string str)

Converts a string to lower camel case

  • Parameter str: String to process
  • Returns: Converts a string to lower camel case

Fast.IaaS.StringExtension.ClearStringAffixes

Source · Targets: netstandard2.1

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

Removes string prefixes and suffixes

  • Parameter str: String to process
  • Parameter pos: Starting position
  • Parameter affixes: Prefixes and suffixes to remove or retain
  • Returns: Removes string prefixes and suffixes

Fast.IaaS.StringExtension.Format

Source · Targets: netstandard2.1

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

Formats a string

  • Parameter str: String to process
  • Parameter args: Arguments used to format the message
  • Returns: Formats a string

Fast.IaaS.StringExtension.GetCharLength

Source · Targets: netstandard2.1

csharp
public static int GetCharLength(this string str)

Gets the character length

  • Parameter str: String to process
  • Returns: The character length

Fast.IaaS.StringExtension.PadStringLeftAlign

Source · Targets: netstandard2.1

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

Left-aligns a string to a fixed width, padding on the right with spaces

  • Parameter strTemp: String accumulated during recursive processing
  • Parameter length: Target length
  • Returns: Left-aligns a string to a fixed width, padding on the right with spaces

Fast.IaaS.StringExtension.PadStringRightAlign

Source · Targets: netstandard2.1

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

Right-aligns a string to a fixed width, padding on the left with spaces

  • Parameter strTemp: String accumulated during recursive processing
  • Parameter length: Target length
  • Returns: Right-aligns a string to a fixed width, padding on the left with spaces

Fast.IaaS.StringExtension.SplitString

Source · Targets: netstandard2.1

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

Splits a string into fixed-length array elements

  • Parameter strTemp: String accumulated during recursive processing
  • Parameter length: Target length
  • Returns: The array of fixed-length string elements

Fast.IaaS.StringExtension.GetSubStringWithEllipsis

Source · Targets: netstandard2.1

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

Truncates a string to the specified length

  • Parameter value: String to process
  • Parameter length: Target length
  • Parameter ellipsis: Ellipsis marker appended when text is truncated
  • Returns: Truncates a string to the specified length

Fast.IaaS.StringExtension.GetNVarcharMaxLen

Source · Targets: netstandard2.1

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

Gets the maximum byte length for SQL Server NVarchar

  • Parameter str: String to process
  • Parameter maxLen: Target length
  • Parameter ellipsis: Ellipsis marker appended when text is truncated
  • Returns: The maximum byte length for SQL Server NVarchar

Fast.IaaS.TimeSpanExtension

Source · Targets: netstandard2.1

csharp
public static class TimeSpanExtension

Extensions for TimeSpan

Fast.IaaS.TimeSpanExtension.ToDescription

Source · Targets: netstandard2.1

csharp
public static string ToDescription(this TimeSpan timeSpan)

Gets a description

  • Parameter timeSpan: Time interval to process
  • Returns: The resulting description

Fast.IaaS.TypeExtension

Source · Targets: netstandard2.1

csharp
public static class TypeExtension

Extensions for Type

Fast.IaaS.TypeExtension.HasImplementedRawGeneric

Source · Targets: netstandard2.1

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

Checks whether a type implements a generic type

  • Parameter type: Target type
  • Parameter generic: Whether to match using generic-type rules
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.GetAssemblyName

Source · Targets: netstandard2.1

csharp
public static string GetAssemblyName(this Type type)

Gets the name of the assembly containing the type

  • Parameter type: Target type
  • Returns: The name of the assembly containing the type

Fast.IaaS.TypeExtension.GetAssemblyName

Source · Targets: netstandard2.1

csharp
public static string GetAssemblyName(this TypeInfo typeInfo)

Gets the name of the assembly containing the type

  • Parameter typeInfo: Reflection metadata for the target type
  • Returns: The name of the assembly containing the type

Fast.IaaS.TypeExtension.IsRichPrimitive

Source · Targets: netstandard2.1

csharp
public static bool IsRichPrimitive(this Type type)

Checks whether the type is a rich primitive type

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsValueTuple

Source · Targets: netstandard2.1

csharp
public static bool IsValueTuple(this Type type)

Checks whether the type is a tuple

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsStatic

Source · Targets: netstandard2.1

csharp
public static bool IsStatic(this Type type)

Checks whether the type is static

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsAnonymous

Source · Targets: netstandard2.1

csharp
public static bool IsAnonymous(this Type type)

Checks whether the type is anonymous

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsInstantiable

Source · Targets: netstandard2.1

csharp
public static bool IsInstantiable(this Type type)

Checks whether the type can be instantiated

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsAlienAssignableTo

Source · Targets: netstandard2.1

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

Checks whether the type derives from the specified type

  • Parameter type: Target type
  • Parameter fromType: Source type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.GetDefinedCustomAttribute

Source · Targets: netstandard2.1

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

Gets an instance of the specified attribute

Remarks: Returns null when the attribute is absent

  • Parameter type: Target type
  • Parameter inherit: Whether to continue searching base types for members or attributes
  • Type parameter TAttribute: Attribute type to find
  • Returns: The specified attribute instance

Fast.IaaS.TypeExtension.HasDefinePublicParameterlessConstructor

Source · Targets: netstandard2.1

csharp
public static bool HasDefinePublicParameterlessConstructor(this Type type)

Checks whether the type defines a public parameterless constructor

Remarks: Used for instantiation with Activator.CreateInstance(Type)

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsDefinitionEqual

Source · Targets: netstandard2.1

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

Checks equality with the specified type definition

  • Parameter type: Target type
  • Parameter compareType: Type to compare
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsCompatibilityTo

Source · Targets: netstandard2.1

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

Checks compatibility with the specified inherited type

  • Parameter type: Target type
  • Parameter inheritType: Inherited type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsDeclarationMethod

Source · Targets: netstandard2.1

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

Checks whether the type defines the specified method

  • Parameter type: Target type
  • Parameter name: Method name
  • Parameter accessibilityBindingFlags: Binding flags used to filter member visibility
  • Parameter methodInfo: Reflection metadata for the target method
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsInteger

Source · Targets: netstandard2.1

csharp
public static bool IsInteger(this Type type)

Checks whether the type is an integer type

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsDecimal

Source · Targets: netstandard2.1

csharp
public static bool IsDecimal(this Type type)

Checks whether the type is a fractional numeric type

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsNumeric

Source · Targets: netstandard2.1

csharp
public static bool IsNumeric(this Type type)

Checks whether the type is numeric

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.IsDictionary

Source · Targets: netstandard2.1

csharp
public static bool IsDictionary(this Type type)

Checks whether the type is a dictionary

  • Parameter type: Target type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.TypeExtension.GetTypeAttribute

Source · Targets: netstandard2.1

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

Gets a custom attribute from the type

  • Parameter type: Target type
  • Parameter inherit: Whether to continue searching base types for members or attributes
  • Type parameter TAttribute: Attribute type to find
  • Returns: The type's custom attribute

Fast.IaaS.ValidateExtension

Source · Targets: netstandard2.1

csharp
public static class ValidateExtension

Validation extensions

Fast.IaaS.ValidateExtension.IsEmpty

Source · Targets: netstandard2.1

csharp
public static bool IsEmpty(this string value)

Checks whether a string is null

  • Parameter value: String
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsEmpty

Source · Targets: netstandard2.1

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

Checks whether an Enum is null

  • Parameter value: Value to validate
  • Type parameter TEnum: Enum type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsEmpty

Source · Targets: netstandard2.1

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

Checks whether an Enum is null

  • Parameter value: Value to validate
  • Type parameter TEnum: Enum type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

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

Checks whether an Enum is null or 0

  • Parameter value: Value to validate
  • Type parameter TEnum: Enum type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

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

Checks whether an Enum is null or 0

  • Parameter value: Value to validate
  • Type parameter TEnum: Enum type
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this byte? value)

Checks whether a byte is null or 0

  • Parameter value: Value to validate
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this int? value)

Checks whether an int is null or 0

  • Parameter value: Value to validate
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this double? value)

Checks whether a double is null or 0

  • Parameter value: Double value
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this decimal? value)

Checks whether a decimal is null or 0

  • Parameter value: Decimal value
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this float? value)

Checks whether a float is null or 0

  • Parameter value: Decimal value
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNullOrZero

Source · Targets: netstandard2.1

csharp
public static bool IsNullOrZero(this long? value)

Checks whether a long is null or 0

  • Parameter value: Value to validate
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNumber

Source · Targets: netstandard2.1

csharp
public static bool IsNumber(this string str)

Validates a positive decimal number string

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsDecimalNumber

Source · Targets: netstandard2.1

csharp
public static bool IsDecimalNumber(this string str)

Validates a signed decimal number string

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsTel

Source · Targets: netstandard2.1

csharp
public static bool IsTel(this string str)

Validates a Chinese telephone number in a format such as 010-85849685

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsPhone

Source · Targets: netstandard2.1

csharp
public static bool IsPhone(this string str)

Validates a telephone number string

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsFax

Source · Targets: netstandard2.1

csharp
public static bool IsFax(this string str)

Checks whether a fax number is valid

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsMobile

Source · Targets: netstandard2.1

csharp
public static bool IsMobile(this string str)

Validates mobile numbers with prefixes 13, 14, 15, 16, 17, 18 or 19; leading 0 or 86 is recognized automatically

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsIdCard

Source · Targets: netstandard2.1

csharp
public static bool IsIdCard(this string str)

Checks whether an identity card number is valid

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsIdCard18

Source · Targets: netstandard2.1

csharp
public static bool IsIdCard18(this string str)

Validates an 18-digit identity card number

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsIdCard15

Source · Targets: netstandard2.1

csharp
public static bool IsIdCard15(this string str)

Validates a 15-digit identity card number

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsEmail

Source · Targets: netstandard2.1

csharp
public static bool IsEmail(this string str)

Checks whether an email address is valid

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsQqEmail

Source · Targets: netstandard2.1

csharp
public static bool IsQqEmail(this string str)

Checks whether a QQ email address is valid

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsOnlyChinese

Source · Targets: netstandard2.1

csharp
public static bool IsOnlyChinese(this string strLn)

Checks whether the input contains only Chinese characters

  • Parameter strLn: Text line to append
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsBadString

Source · Targets: netstandard2.1

csharp
public static bool IsBadString(this string str)

Checks for extra characters; the source describes this as SQL-injection filtering

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsNzx

Source · Targets: netstandard2.1

csharp
public static bool IsNzx(this string str)

Checks for a string containing only digits, English letters or underscores

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsAlphaNumericChinese

Source · Targets: netstandard2.1

csharp
public static bool IsAlphaNumericChinese(this string str)

A string containing digits, English letters and Chinese characters

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsAlphaNumeric

Source · Targets: netstandard2.1

csharp
public static bool IsAlphaNumeric(this string str)

Checks for a string containing only digits and English letters

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.IsPostCode

Source · Targets: netstandard2.1

csharp
public static bool IsPostCode(this string str)

Validates a postal code string

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ValidateExtension.CheckLength

Source · Targets: netstandard2.1

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

Checks the input object's length

  • Parameter str: String to process
  • Parameter length: Target length
  • Returns: Returns true when the string length equals length; otherwise false

Fast.IaaS.ValidateExtension.IsDateTime

Source · Targets: netstandard2.1

csharp
public static bool IsDateTime(this string str)

Checks whether user input is a date

Remarks: Recognized formats: YYYY | YYYY-MM | YYYYMM | YYYY-MM-DD | YYYYMMDD | YYYY-MM-DD HH:MM:SS | YYYY-MM-DD HH:MM:SS.FFF. A slash can replace a hyphen without affecting validation.

  • Parameter str: String to process
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.ITreeNode

Source · Targets: netstandard2.1

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

Tree base interface

  • Type parameter TProperty: Property value type

Fast.IaaS.ITreeNode.GetId

Source · Targets: netstandard2.1

csharp
TProperty GetId();

Gets the node ID

  • Returns: The node ID

Fast.IaaS.ITreeNode.GetPid

Source · Targets: netstandard2.1

csharp
TProperty GetPid();

Gets the parent node ID

  • Returns: The parent node ID

Fast.IaaS.ITreeNode.GetSort

Source · Targets: netstandard2.1

csharp
TProperty GetSort();

Gets the sort field

  • Returns: The sort field

Fast.IaaS.ITreeNode.SetChildren

Source · Targets: netstandard2.1

csharp
void SetChildren(IList children);

Sets Children

  • Parameter children: Direct child nodes of the current node

Fast.IaaS.CoordinateUtil

Source · Targets: netstandard2.1

csharp
public static class CoordinateUtil

Coordinate utilities

Remarks: WGS-84 is the global coordinate reference system commonly used for GPS. GCJ-02 is the Chinese offset coordinate system, also called Mars coordinates, used by domestic mapping services.

Fast.IaaS.CoordinateUtil.IsInChina

Source · Targets: netstandard2.1

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

Checks whether the coordinates are within China. GCJ-02 offsets apply only within China; coordinates outside China need no conversion.

  • Parameter lat: Latitude
  • Parameter lng: Longitude
  • Returns: Returns true when the condition is met; otherwise false

Fast.IaaS.CoordinateUtil.WGS84ToGCJ02

Source · Targets: netstandard2.1

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

WGS-84 to GCJ-02 (Mars coordinates)

Remarks: Returns the original coordinates when outside China

  • Parameter wgLat: Latitude
  • Parameter wgLng: Longitude
  • Returns: WGS-84 to GCJ-02 (Mars coordinates)

Fast.IaaS.CoordinateUtil.GCJ02ToWGS84

Source · Targets: netstandard2.1

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

GCJ-02 (Mars coordinates) to WGS-84

Remarks: Exact inversion is complex; this implementation uses an iterative approximation

  • Parameter mgLat: Latitude
  • Parameter mgLng: Longitude
  • Returns: GCJ-02 (Mars coordinates) to WGS-84

Fast.IaaS.CryptoUtil

Source · Targets: netstandard2.1

csharp
public static class CryptoUtil

Encryption and decryption utilities

Fast.IaaS.CryptoUtil.PemKeyPair

Source · Targets: netstandard2.1

csharp
public sealed class PemKeyPair

PEM key pair using a PKCS#8 private key and a SubjectPublicKeyInfo public key

Fast.IaaS.CryptoUtil.PemKeyPair.PrivateKey

Source · Targets: netstandard2.1

csharp
public string PrivateKey { get; }

Unencrypted PKCS#8 PEM private key

Fast.IaaS.CryptoUtil.PemKeyPair.PublicKey

Source · Targets: netstandard2.1

csharp
public string PublicKey { get; }

SubjectPublicKeyInfo PEM public key

Fast.IaaS.CryptoUtil.GenerateRandomBytes

Source · Targets: netstandard2.1

csharp
public static byte[] GenerateRandomBytes(int length)

Generates secure random bytes with the platform cryptographic random number generator

  • Parameter length: Number of bytes to generate, from 0 to 65,536
  • Returns: A new byte array of the specified length
  • Throws ArgumentOutOfRangeException: length is outside the permitted range

Fast.IaaS.CryptoUtil.FixedTimeEquals

Source · Targets: netstandard2.1

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

Compares two byte arrays without content-dependent early termination

  • Parameter left: First byte array
  • Parameter right: Second byte array
  • Returns: Returns true when lengths and all bytes match

Fast.IaaS.CryptoUtil.MD5Encrypt

Source · Targets: netstandard2.1

csharp
public static string MD5Encrypt(string content)

Computes a string hash using MD5

Remarks: For ordinary non-security checks only; do not use for password storage, signatures or collision-resistant purposes

  • Parameter content: Content to process
  • Returns: Computes a string hash using MD5

Fast.IaaS.CryptoUtil.SHA1Encrypt

Source · Targets: netstandard2.1

csharp
public static string SHA1Encrypt(string str)

Computes a SHA-1 hash

Remarks: For ordinary non-security checks only; do not use for password storage, signatures or collision-resistant purposes

  • Parameter str: String to process
  • Returns: The computed SHA-1 hash

Fast.IaaS.CryptoUtil.SHA256Encrypt

Source · Targets: netstandard2.1

csharp
public static string SHA256Encrypt(string content)

Computes the SHA-256 hash of a string

  • Parameter content: Content to process
  • Returns: The computed SHA-256 string hash

Fast.IaaS.CryptoUtil.SHA256Bytes

Source · Targets: netstandard2.1

csharp
public static byte[] SHA256Bytes(string content)

Computes a 32-byte SHA-256 digest of UTF-8 text

  • Parameter content: UTF-8 text to hash
  • Returns: 32-byte SHA-256 digest

Fast.IaaS.CryptoUtil.SHA384Encrypt

Source · Targets: netstandard2.1

csharp
public static string SHA384Encrypt(string content)

Computes a SHA-384 digest of UTF-8 text as uppercase hexadecimal

  • Parameter content: UTF-8 text to hash
  • Returns: SHA-384 digest containing 96 uppercase hexadecimal characters

Fast.IaaS.CryptoUtil.SHA384Bytes

Source · Targets: netstandard2.1

csharp
public static byte[] SHA384Bytes(string content)

Computes a 48-byte SHA-384 digest of UTF-8 text

  • Parameter content: UTF-8 text to hash
  • Returns: 48-byte SHA-384 digest

Fast.IaaS.CryptoUtil.SHA512Encrypt

Source · Targets: netstandard2.1

csharp
public static string SHA512Encrypt(string content)

Computes a SHA-512 digest of UTF-8 text as uppercase hexadecimal

  • Parameter content: UTF-8 text to hash
  • Returns: SHA-512 digest containing 128 uppercase hexadecimal characters

Fast.IaaS.CryptoUtil.SHA512Bytes

Source · Targets: netstandard2.1

csharp
public static byte[] SHA512Bytes(string content)

Computes a 64-byte SHA-512 digest of UTF-8 text

  • Parameter content: UTF-8 text to hash
  • Returns: 64-byte SHA-512 digest

Fast.IaaS.CryptoUtil.HMACSHA256Encrypt

Source · Targets: netstandard2.1

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

Authenticates UTF-8 text with HMAC-SHA-256

  • Parameter content: UTF-8 text to authenticate
  • Parameter key: Nonempty UTF-8 HMAC key
  • Returns: Authentication tag of 64 lowercase hexadecimal characters

Fast.IaaS.CryptoUtil.HMACSHA384Encrypt

Source · Targets: netstandard2.1

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

Authenticates UTF-8 text with HMAC-SHA-384

  • Parameter content: UTF-8 text to authenticate
  • Parameter key: Nonempty UTF-8 HMAC key
  • Returns: Authentication tag of 96 lowercase hexadecimal characters

Fast.IaaS.CryptoUtil.HMACSHA512Encrypt

Source · Targets: netstandard2.1

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

Authenticates UTF-8 text with HMAC-SHA-512

  • Parameter content: UTF-8 text to authenticate
  • Parameter key: Nonempty UTF-8 HMAC key
  • Returns: Authentication tag of 128 lowercase hexadecimal characters

Fast.IaaS.CryptoUtil.PBKDF2SHA256

Source · Targets: netstandard2.1

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

Derives a key of the specified length from a UTF-8 password using PBKDF2-HMAC-SHA-256

Remarks: Generate the salt with a secure random number generator and use at least 16 bytes. The derived output does not include the salt or iteration count.

  • Parameter password: Password containing 1 to 1,024 UTF-8 bytes
  • Parameter salt: Salt of at least 8 bytes
  • Parameter iterations: PBKDF2 iteration count, from 100,000 to 5,000,000
  • Parameter outputLength: Derived key length, from 1 to 1,024 bytes
  • Returns: Derived key of the specified length
  • Throws ArgumentOutOfRangeException: Password, salt, iteration count or output length is outside the permitted range

Fast.IaaS.CryptoUtil.HashPasswordPBKDF2SHA256

Source · Targets: netstandard2.1

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

Generates a persistable PBKDF2-HMAC-SHA-256 password hash with a random salt

  • Parameter password: Password containing 1 to 1,024 UTF-8 bytes
  • Parameter iterations: PBKDF2 iteration count, from 100,000 to 5,000,000
  • Returns: A self-describing string containing the version, iteration count, 16-byte random salt and 32-byte derived key
  • Throws ArgumentOutOfRangeException: Password or iteration count is outside the permitted range

Fast.IaaS.CryptoUtil.VerifyPasswordPBKDF2SHA256

Source · Targets: netstandard2.1

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

Verifies a password hash created by HashPasswordPBKDF2SHA256

  • Parameter password: Password to verify
  • Parameter passwordHash: Self-describing PBKDF2-HMAC-SHA-256 password hash
  • Returns: Returns true for a valid format and matching password; returns false for an invalid format

Fast.IaaS.CryptoUtil.HKDFSHA256

Source · Targets: netstandard2.1

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

Derives context-separated key material using RFC 5869 HKDF-SHA-256

  • Parameter inputKeyMaterial: Input key material, such as a raw ECDH shared secret
  • Parameter salt: Optional salt; null uses 32 zero bytes
  • Parameter info: Optional application and purpose context
  • Parameter outputLength: Output length, from 1 to 8,160 bytes
  • Returns: Derived key of the specified length bound to the info context
  • Throws ArgumentOutOfRangeException: outputLength exceeds the RFC 5869 limit

Fast.IaaS.CryptoUtil.AESEncrypt

Source · Targets: netstandard2.1

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

Encrypts the supplied string using AES

Remarks: Reusing a fixed IV with the same key reveals plaintext patterns. Supply an unpredictable, nonrepeating IV for different data.

  • Parameter dataStr: Data text to parse or process
  • Parameter key: Encryption key; must have length 32
  • Parameter vector: Initialization vector for symmetric encryption
  • Parameter cipherMode: Cipher block mode for symmetric encryption
  • Parameter paddingMode: Padding mode for symmetric encryption
  • Returns: Encrypts the supplied string using AES

Fast.IaaS.CryptoUtil.AESDecrypt

Source · Targets: netstandard2.1

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

Decrypts the supplied Base64-encoded string using AES

  • Parameter dataStr: Data text to parse or process
  • Parameter key: Decryption key; must have length 32
  • Parameter vector: Initialization vector for symmetric encryption
  • Parameter cipherMode: Cipher block mode for symmetric encryption
  • Parameter paddingMode: Padding mode for symmetric encryption
  • Returns: Decrypts the supplied Base64-encoded string using AES

Fast.IaaS.CryptoUtil.AESEncryptAuthenticated

Source · Targets: netstandard2.1

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

Encrypts and authenticates a string using AES-GCM

Remarks: Provides both confidentiality and integrity; CBC/ECB do not provide authentication

  • Parameter dataStr: Data text to parse or process
  • Parameter key: Key material, internally normalized to a 256-bit key using SHA-256
  • Returns: Base64 string containing the format version, random nonce, authentication tag and ciphertext

Fast.IaaS.CryptoUtil.AESDecryptAuthenticated

Source · Targets: netstandard2.1

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

Decrypts and verifies a string produced by AESEncryptAuthenticated

  • Throws CryptographicException: The key is incorrect, ciphertext was tampered with, or the format is unsupported
  • Parameter dataStr: Data text to parse or process
  • Parameter key: Key material used for encryption
  • Returns: Decrypts and verifies a string produced by AESEncryptAuthenticated

Fast.IaaS.CryptoUtil.AESEncryptWithPassword

Source · Targets: netstandard2.1

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

Derives an AES-256-GCM key using PBKDF2-HMAC-SHA-256 and performs authenticated encryption of UTF-8 text

Remarks: Each call generates an independent 16-byte salt and 12-byte nonce. The result uses the same format as the TypeScript aesEncryptWithPassword utility.

  • Parameter dataStr: Plaintext no larger than 8 MiB when UTF-8 encoded
  • Parameter password: Password containing 1 to 1,024 UTF-8 bytes
  • Parameter iterations: PBKDF2 iteration count; defaults to 600,000
  • Returns: Self-describing string containing version, iterations, salt, nonce, ciphertext and authentication tag

Fast.IaaS.CryptoUtil.AESDecryptWithPassword

Source · Targets: netstandard2.1

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

Decrypts and authenticates the cross-language payload produced by AESEncryptWithPassword

  • Parameter payload: Payload containing version, iterations, salt, nonce, ciphertext and authentication tag
  • Parameter password: Password used for encryption
  • Returns: Original UTF-8 plaintext after successful authentication
  • Throws ArgumentOutOfRangeException: Payload or password exceeds the supported length
  • Throws CryptographicException: Incorrect password, modified payload or invalid format

Fast.IaaS.CryptoUtil.GenerateRSAKeyPair

Source · Targets: netstandard2.1

csharp
public static PemKeyPair GenerateRSAKeyPair(int modulusLength = 2048)

Generates an RSA PKCS#8/SPKI PEM key pair interoperable between .NET and Web Crypto

  • Parameter modulusLength: RSA modulus length in bits; defaults to 2,048, must be at least 2,048 and a multiple of 256
  • Returns: PEM key pair containing an unencrypted PKCS#8 private key and SubjectPublicKeyInfo public key
  • Throws ArgumentOutOfRangeException: modulusLength violates the security bounds

Fast.IaaS.CryptoUtil.RSAEncryptOAEP

Source · Targets: netstandard2.1

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

Encrypts UTF-8 text using an RSA-OAEP/SHA-256 public key

  • Parameter dataStr: UTF-8 plaintext; its length must satisfy the RSA-OAEP modulus limit
  • Parameter publicKeyPem: SubjectPublicKeyInfo PEM public key
  • Returns: Base64-encoded RSA ciphertext
  • Throws CryptographicException: Invalid public key format or plaintext exceeds RSA-OAEP capacity

Fast.IaaS.CryptoUtil.RSADecryptOAEP

Source · Targets: netstandard2.1

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

Decrypts Base64 ciphertext using an RSA-OAEP/SHA-256 private key

  • Parameter dataStr: Base64-encoded RSA ciphertext
  • Parameter privateKeyPem: Unencrypted PKCS#8 PEM private key
  • Returns: Decrypted UTF-8 text
  • Throws FormatException: dataStr is not valid Base64
  • Throws CryptographicException: Invalid private key format, mismatched key or corrupted ciphertext

Fast.IaaS.CryptoUtil.RSASignPSS

Source · Targets: netstandard2.1

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

Signs UTF-8 text using an RSA-PSS/SHA-256 private key

  • Parameter dataStr: UTF-8 text to sign
  • Parameter privateKeyPem: Unencrypted PKCS#8 PEM private key
  • Returns: Base64-encoded RSA-PSS signature; the PSS salt length equals the SHA-256 digest length
  • Throws CryptographicException: Invalid private key format or signing failed

Fast.IaaS.CryptoUtil.RSAVerifyPSS

Source · Targets: netstandard2.1

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

Verifies a Base64 signature using an RSA-PSS/SHA-256 public key

  • Parameter dataStr: UTF-8 text used when signing
  • Parameter signature: Base64-encoded RSA-PSS signature
  • Parameter publicKeyPem: SubjectPublicKeyInfo PEM public key
  • Returns: Returns true when the signature format is valid and matches the content and public key
  • Throws FormatException: signature is not valid Base64
  • Throws CryptographicException: Invalid public key format

Fast.IaaS.CryptoUtil.GenerateECDSAKeyPair

Source · Targets: netstandard2.1

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

Generates an ECDSA PKCS#8/SPKI PEM signing key pair

  • Parameter namedCurve: NIST curve name: P-256, P-384 or P-521
  • Returns: PEM key pair containing an unencrypted PKCS#8 private key and SubjectPublicKeyInfo public key
  • Throws ArgumentOutOfRangeException: Unsupported namedCurve

Fast.IaaS.CryptoUtil.ECDSASign

Source · Targets: netstandard2.1

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

Signs UTF-8 text using ECDSA and the curve's corresponding SHA-2 digest

Remarks: Signatures use IEEE P1363 fixed-field concatenation, matching Web Crypto

  • Parameter dataStr: UTF-8 text to sign
  • Parameter privateKeyPem: Unencrypted EC PKCS#8 PEM private key
  • Parameter namedCurve: NIST curve used by the private key
  • Returns: Base64-encoded IEEE P1363 ECDSA signature
  • Throws CryptographicException: Private key format or curve mismatch

Fast.IaaS.CryptoUtil.ECDSAVerify

Source · Targets: netstandard2.1

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

Verifies a Web Crypto-compatible ECDSA IEEE P1363 Base64 signature

  • Parameter dataStr: UTF-8 text used when signing
  • Parameter signature: Base64-encoded IEEE P1363 ECDSA signature
  • Parameter publicKeyPem: EC SubjectPublicKeyInfo PEM public key
  • Parameter namedCurve: NIST curve used by the public key
  • Returns: Returns true when the signature matches the content, public key and curve
  • Throws FormatException: signature is not valid Base64
  • Throws CryptographicException: Public key format or curve mismatch

Fast.IaaS.CryptoUtil.GenerateECDHKeyPair

Source · Targets: netstandard2.1

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

Generates an ECDH PKCS#8/SPKI PEM key agreement pair

  • Parameter namedCurve: NIST curve name: P-256, P-384 or P-521
  • Returns: PEM key pair containing an unencrypted PKCS#8 private key and SubjectPublicKeyInfo public key
  • Throws ArgumentOutOfRangeException: Unsupported namedCurve

Fast.IaaS.CryptoUtil.DeriveECDHSecret

Source · Targets: netstandard2.1

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

Derives a raw ECDH shared secret

Remarks: The raw secret must be processed with a KDF such as HKDF; do not use it directly as a long-term key

  • Parameter privateKeyPem: Local unencrypted EC PKCS#8 PEM private key
  • Parameter publicKeyPem: Peer EC SubjectPublicKeyInfo PEM public key
  • Parameter namedCurve: NIST curve used by both keys
  • Returns: Raw ECDH shared secret with the curve field length
  • Throws CryptographicException: Invalid key format, curve or key agreement
  • Throws PlatformNotSupportedException: The runtime does not support raw ECDH key agreement

Fast.IaaS.CryptoUtil.DeriveECDHKeySHA256

Source · Targets: netstandard2.1

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

Derives a 32-byte shared key using ECDH followed by SHA-256

Remarks: Calls the platform ECDH SHA-256 KDF directly, in preference to using the raw shared secret

  • Parameter privateKeyPem: Local unencrypted EC PKCS#8 PEM private key
  • Parameter publicKeyPem: Peer EC SubjectPublicKeyInfo PEM public key
  • Parameter namedCurve: NIST curve used by both keys
  • Returns: 32-byte shared key
  • Throws CryptographicException: Invalid key format, curve or key agreement

Fast.IaaS.DateTimeUtil

Source · Targets: netstandard2.1

csharp
public static class DateTimeUtil

DateTime utilities

Fast.IaaS.DateTimeUtil.GetYearMonthFirstDay

Source · Targets: netstandard2.1

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

Gets the first day of the specified year and month

  • Parameter year: Year
  • Parameter month: Month
  • Returns: DateTime representing the first day

Fast.IaaS.DateTimeUtil.GetYearMonthFirstDay

Source · Targets: netstandard2.1

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

Gets the first day of the specified year and month

  • Parameter year: Year
  • Parameter month: Month
  • Returns: DateTime representing the first day

Fast.IaaS.DateTimeUtil.GetYearMonthLastDay

Source · Targets: netstandard2.1

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

Gets the last day of the specified year and month

  • Parameter year: Year
  • Parameter month: Month
  • Returns: DateTime representing the last day

Fast.IaaS.DateTimeUtil.GetYearMonthLastDay

Source · Targets: netstandard2.1

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

Gets the last day of the specified year and month

  • Parameter year: Year
  • Parameter month: Month
  • Returns: DateTime representing the last day

Fast.IaaS.DateTimeUtil.DateDiffDay

Source · Targets: netstandard2.1

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

Calculates the difference between two times in days

  • Parameter startTime: Start of the time range
  • Parameter lastTime: Previous execution or recorded time
  • Returns: The calculated difference between the two times in days

Fast.IaaS.FileUtil

Source · Targets: netstandard2.1

csharp
public static class FileUtil

File utilities

Fast.IaaS.FileUtil.GetFileSHA256

Source · Targets: netstandard2.1

csharp
public static string GetFileSHA256(string filePath)

Gets the SHA-256 hash of a file

  • Parameter filePath: File path
  • Returns: The file's SHA-256 hash

Fast.IaaS.FileUtil.GetFileSHA1

Source · Targets: netstandard2.1

csharp
public static string GetFileSHA1(string filePath)

Gets the SHA1 hash of a file

  • Parameter filePath: File path
  • Returns: SHA1 hash string in lowercase hexadecimal

Fast.IaaS.FileUtil.CopyFile

Source · Targets: netstandard2.1

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

Copies a file

  • Parameter fromPath: Source path
  • Parameter toPath: Destination path

Fast.IaaS.FileUtil.TryCreateDirectory

Source · Targets: netstandard2.1

csharp
public static void TryCreateDirectory(string path)

Attempts to create a directory

  • Parameter path: Path

Fast.IaaS.GuidUtil

Source · Targets: netstandard2.1

csharp
public static class GuidUtil

Guid utilities

Fast.IaaS.GuidUtil.GetGuid

Source · Targets: netstandard2.1

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

Generates a Guid

Remarks: Supports only the N, D, B and P Guid formats

  • Parameter format: Formatting mode
  • Returns: The generated Guid

Fast.IaaS.GuidUtil.GetShortGuid

Source · Targets: netstandard2.1

csharp
public static string GetShortGuid()

Generates a short Guid

  • Returns: The generated short Guid

Fast.IaaS.MaskingUtil

Source · Targets: netstandard2.1

csharp
public static class MaskingUtil

Data masking utilities

Fast.IaaS.MaskingUtil.NameMasking

Source · Targets: netstandard2.1

csharp
public static string NameMasking(string name)

Masks a name, retaining only the first character

  • Parameter name: Name
  • Returns: Masks a name, retaining only the first character

Fast.IaaS.MaskingUtil.NameKeepLastMasking

Source · Targets: netstandard2.1

csharp
public static string NameKeepLastMasking(string name)

Masks a name, retaining the first and last characters

  • Parameter name: Name
  • Returns: Masks a name, retaining the first and last characters

Fast.IaaS.MaskingUtil.MobileMasking

Source · Targets: netstandard2.1

csharp
public static string MobileMasking(string mobile)

Masks a mobile number, for example 152****5552

  • Parameter mobile: Mobile number to mask
  • Returns: Masks a mobile number, for example 152****5552

Fast.IaaS.MaskingUtil.IdCardMasking

Source · Targets: netstandard2.1

csharp
public static string IdCardMasking(string idCard)

Masks an identity card number, retaining the first and last four characters

  • Parameter idCard: Identity card number to mask
  • Returns: Masks an identity card number, retaining the first and last four characters

Fast.IaaS.MaskingUtil.EmailMasking

Source · Targets: netstandard2.1

csharp
public static string EmailMasking(string email)

Masks an email address, retaining at most three characters plus the domain

  • Parameter email: Email address to mask
  • Returns: Masks an email address, retaining at most three characters plus the domain

Fast.IaaS.MaskingUtil.BankCardMasking

Source · Targets: netstandard2.1

csharp
public static string BankCardMasking(string cardNo)

Masks a bank card number, retaining the first six and last four characters

  • Parameter cardNo: Bank card number to mask
  • Returns: Masks a bank card number, retaining the first six and last four characters

Fast.IaaS.MaskingUtil.AddressMasking

Source · Targets: netstandard2.1

csharp
public static string AddressMasking(string address)

Masks an address, preferring administrative divisions such as province, city, district and street and retaining higher-level regions

  • Parameter address: Target service address
  • Returns: Masks an address, preferring administrative divisions such as province, city, district and street and retaining higher-level regions

Fast.IaaS.MaskingUtil.CarNumberMasking

Source · Targets: netstandard2.1

csharp
public static string CarNumberMasking(string carNumber)

Masks a license plate, retaining the first two characters or the province, area letter and separator when a separator exists

  • Parameter carNumber: License plate number to validate
  • Returns: Masks a license plate, retaining the first two characters or the province, area letter and separator when a separator exists

Fast.IaaS.MaskingUtil.IpMasking

Source · Targets: netstandard2.1

csharp
public static string IpMasking(string ip)

Masks an IP address, retaining the first two segments

  • Parameter ip: IP address to validate
  • Returns: Masks an IP address, retaining the first two segments

Fast.IaaS.NumberUtil

Source · Targets: netstandard2.1

csharp
public static class NumberUtil

Sequence utilities

Fast.IaaS.NumberUtil.IdToCodeByLong

Source · Targets: netstandard2.1

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

Converts an ID to a Crockford Base32 string

  • Parameter id: ID to encode
  • Parameter maxLength: Target length
  • Returns: The converted Crockford Base32 string

Fast.IaaS.RetryUtil

Source · Targets: netstandard2.1

csharp
public sealed class RetryUtil

Static retry utilities

Fast.IaaS.RetryUtil.Invoke

Source · Targets: 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)

Retries an operation that throws, optionally restricted to specific exceptions

  • Parameter action: Operation delegate to execute
  • Parameter numRetries: Maximum retry count
  • Parameter retryTimeout: Wait duration between retries
  • Parameter finalThrow: Factory for the exception thrown after retries are exhausted
  • Parameter exceptionTypes: Exception types that may trigger retries
  • Parameter fallbackPolicy: Fallback policy used after retries are exhausted
  • Parameter retryAction: Retry callback executed after each failure

Fast.IaaS.RetryUtil.InvokeAsync

Source · Targets: 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)

Retries an operation that throws, optionally restricted to specific exceptions

  • Parameter action: Operation delegate to execute
  • Parameter numRetries: Maximum retry count
  • Parameter retryTimeout: Wait duration between retries
  • Parameter finalThrow: Factory for the exception thrown after retries are exhausted
  • Parameter exceptionTypes: Exception types that may trigger retries
  • Parameter fallbackPolicy: Fallback policy used after retries are exhausted
  • Parameter retryAction: Retry callback executed after each failure
  • Parameter cancellationToken: Token used to cancel the asynchronous operation
  • Returns: A task representing the retry operation with optional exception filtering

Fast.IaaS.TreeBuildUtil

Source · Targets: netstandard2.1

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

Recursive utilities for parent-child nodes, such as menu and dictionary trees

  • Type parameter TEntity: Entity type
  • Type parameter TProperty: Property value type

Fast.IaaS.TreeBuildUtil.SetRootParentId

Source · Targets: netstandard2.1

csharp
public void SetRootParentId(TProperty rootParentId)

Sets the parent identifier used for root nodes when building a tree

  • Parameter rootParentId: Parent identifier matched by top-level nodes; defaults to default

Fast.IaaS.TreeBuildUtil.Build

Source · Targets: netstandard2.1

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

Builds tree nodes

  • Parameter nodes: Nodes to arrange into a tree
  • Returns: The constructed tree nodes

Fast.IaaS.VerificationUtil

Source · Targets: netstandard2.1

csharp
public static class VerificationUtil

Validation utilities

Fast.IaaS.VerificationUtil.IdToCodeByLong

Source · Targets: netstandard2.1

csharp
public static string IdToCodeByLong(long id)

Converts an ID to an invitation code

  • Parameter id: Unique identifier
  • Returns: The converted invitation code

Fast.IaaS.VerificationUtil.CodeToIdByLong

Source · Targets: netstandard2.1

csharp
public static long CodeToIdByLong(string code)

Parses an ID from an invitation code

  • Parameter code: Business or enum code
  • Returns: The parsed ID

Fast.IaaS.VerificationUtil.IdToCodeByInt

Source · Targets: netstandard2.1

csharp
public static string IdToCodeByInt(int id)

Converts an ID to an invitation code

  • Parameter id: Unique identifier
  • Returns: The converted invitation code

Fast.IaaS.VerificationUtil.CodeToIdByInt

Source · Targets: netstandard2.1

csharp
public static int CodeToIdByInt(string code)

Parses an ID from an invitation code

  • Parameter code: Business or enum code
  • Returns: The parsed ID

Fast.IaaS.VerificationUtil.PrintBase

Source · Targets: netstandard2.1

csharp
public static string PrintBase()

Displays all strings used for radix encoding

  • Returns: Displays all strings used for radix encoding

Fast.IaaS.VerificationUtil.GenNumVerCode

Source · Targets: netstandard2.1

csharp
public static string GenNumVerCode(int len = CODE_LEN)

Generates a numeric verification code

  • Parameter len: Target length
  • Returns: The generated numeric verification code

Fast.IaaS.VerificationUtil.GenStrVerCode

Source · Targets: netstandard2.1

csharp
public static string GenStrVerCode(int len = CODE_LEN)

Generates a string verification code

  • Parameter len: Target length
  • Returns: The generated string verification code

Fast.IaaS.VerificationUtil.GenRandomNum

Source · Targets: netstandard2.1

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

Generates a random number

  • Parameter minVal: Minimum permitted value
  • Parameter maxVal: Maximum permitted value
  • Parameter isInclude: Whether boundary values are included in the valid range
  • Returns: The generated random number