Method GetValue
- Namespace
- LMKit.Extraction
- Assembly
- LM-Kit.NET.dll
GetValue(string)
Gets the value by name or path as object.
Returns null
if the element is not found.
public object GetValue(string nameOrPath)
Parameters
nameOrPath
stringElement name (e.g., "Total") or exact path (e.g., "Lines[0].Price").
Returns
- object
The resolved value instance or
null
if not found.
Examples
// No generic type needed
var v = result.GetValue("bill_to.street_address");
Console.WriteLine(v ?? "(missing)");
GetValue<T>(string, T)
Get typed value by path or name. Returns defaultValue
if not found or cast fails.
public T GetValue<T>(string nameOrPath, T defaultValue = default)
Parameters
nameOrPath
stringElement name or exact path to resolve.
defaultValue
TFallback value returned when resolution fails. Default is
default(T)
.
Returns
- T
Resolved value converted to
T
, ordefaultValue
.
Type Parameters
T
Requested target type (e.g.,
decimal
,DateTime
).
Examples
var total = result.GetValue<decimal>("Invoice.Total", 0m);
Console.WriteLine(total);