using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.WebUtilities;
using Newtonsoft.Json.Serialization;
public string MyProp { get; set; }
public bool ShouldSerializeMyProp()
Console.WriteLine("CALLED !!!");
return MyProp != "<null>";
public static void Main()
var contractResolver = new DefaultContractResolver();
var jsonSettings = new JsonSerializerSettings
ContractResolver = contractResolver
Console.WriteLine(contractResolver.IgnoreShouldSerializeMembers);
Console.WriteLine(JsonConvert.SerializeObject(test, jsonSettings));
Console.WriteLine(JsonConvert.SerializeObject(test, jsonSettings));
Console.WriteLine(JsonConvert.SerializeObject(test, jsonSettings));
public static void Main3()
var queryParams = new Dictionary<string, string>
var uri = QueryHelpers.AddQueryString("lbs", queryParams);
public static async Task Main2()
var tasks = new List<Task>();
for (int i = 0; i < 1000; i++)
tasks.Add(Task.Run(() => TestAsync(i)));
await Task.WhenAll(tasks);
private static async Task TestAsync(int i)
Console.WriteLine(i.ToString());