-Samples!
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
|
||||
{
|
||||
public class CreateJsonDynamic
|
||||
{
|
||||
public void Example()
|
||||
{
|
||||
#region Usage
|
||||
dynamic product = new JObject();
|
||||
product.ProductName = "Elbow Grease";
|
||||
product.Enabled = true;
|
||||
product.Price = 4.90m;
|
||||
product.StockCount = 9000;
|
||||
product.StockValue = 44100;
|
||||
product.Tags = new JArray("Real", "OnSale");
|
||||
|
||||
Console.WriteLine(product.ToString());
|
||||
// {
|
||||
// "ProductName": "Elbow Grease",
|
||||
// "Enabled": true,
|
||||
// "Price": 4.90,
|
||||
// "StockCount": 9000,
|
||||
// "StockValue": 44100,
|
||||
// "Tags": [
|
||||
// "Real",
|
||||
// "OnSale"
|
||||
// ]
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user