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
nameOrPathstringElement name (e.g., "Total") or exact path (e.g., "Lines[0].Price").
Returns
- object
The resolved value instance or
nullif 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
nameOrPathstringElement name or exact path to resolve.
defaultValueTFallback value returned when resolution fails. Default is
default(T).
Returns
- T
Resolved value converted to
T, ordefaultValue.
Type Parameters
TRequested target type (e.g.,
decimal,DateTime).
Examples
var total = result.GetValue<decimal>("Invoice.Total", 0m);
Console.WriteLine(total);