Click or drag to resize
Json.NET

Serialize an immutable collection

 

This sample serializes an immutable collection into JSON.

Sample
Usage
ImmutableList<string> l = ImmutableList.CreateRange(new List<string>
{
    "One",
    "II",
    "3"
});

string json = JsonConvert.SerializeObject(l, Formatting.Indented);
// [
//   "One",
//   "II",
//   "3"
// ]