Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 650 Bytes

ToObjectGeneric.md

File metadata and controls

26 lines (18 loc) · 650 Bytes

LINQ to JSON with JToken.ToObject

This sample converts LINQ to JSON objects to .NET types using Argon.JToken.ToObject<T>.

var v1 = new JValue(true);

var b = v1.ToObject<bool>();

Console.WriteLine(b);
// true

var i = v1.ToObject<int>();

Console.WriteLine(i);
// 1

var s = v1.ToObject<string>();

Console.WriteLine(s);
// "True"

snippet source | anchor