Table of Contents

Method As

Namespace
LMKit.Extraction
Assembly
LM-Kit.NET.dll

As<T>(T)

Returns Value converted to T, or defaultValue when the value is null or the conversion fails.

public T As<T>(T defaultValue = default)

Parameters

defaultValue T

Fallback returned on null or conversion failure. Default is default(T).

Returns

T

The converted value, or defaultValue.

Type Parameters

T

Target type (e.g. decimal, DateTime, string).

Examples

decimal price = element.As<decimal>(0m);
string  name  = element.As<string>("(unknown)");