Table of Contents

Class ObjectExtensions

Namespace
BootstrapBlazor.Components
Assembly
BootstrapBlazor.dll

Object 扩展方法

public static class ObjectExtensions
Inheritance
ObjectExtensions
Inherited Members

Methods

ConvertToPercentString(string?)

转化为带单位的字符串 [% px] => [% px] [int] => [int]px

public static string ConvertToPercentString(this string? val)

Parameters

val string

Returns

string

GetTypeDesc(Type)

通过类型获取类型描述文字

public static string GetTypeDesc(this Type t)

Parameters

t Type

Returns

string

IsBoolean(Type)

检查是否为 Boolean 数据类型

public static bool IsBoolean(this Type t)

Parameters

t Type

Returns

bool

IsDateTime(Type)

检查是否为 DateTime 数据类型

public static bool IsDateTime(this Type t)

Parameters

t Type

Returns

bool

IsNumber(Type)

检查是否为 Number 数据类型

public static bool IsNumber(this Type t)

Parameters

t Type

Returns

bool

IsTimeSpan(Type)

检查是否为 TimeSpan 数据类型

public static bool IsTimeSpan(this Type t)

Parameters

t Type

Returns

bool

ToFileSizeString(long)

格式化为 文件大小与单位格式 字符串

public static string ToFileSizeString(this long fileSize)

Parameters

fileSize long

Returns

string

TryConvertTo(string?, Type, out object?)

字符串类型转换为其他数据类型

public static bool TryConvertTo(this string? source, Type type, out object? val)

Parameters

source string
type Type
val object

Returns

bool

TryConvertTo<TValue>(string?, out TValue)

public static bool TryConvertTo<TValue>(this string? source, out TValue val)

Parameters

source string
val TValue

Returns

bool

Type Parameters

TValue