namespace SerializationDemo
public class WeatherForecastBase
public DateTimeOffset Date { get; set; }
public int TemperatureCelsius { get; set; }
public string Summary { get; set; }
public class WeatherForecast : WeatherForecastBase
public string Location { get; set; }
public static void Main()
var weatherForecast = new WeatherForecast
Date = DateTime.Parse("2023-08-01"),
Location = "Tel Aviv, Israel"
var serializedWeatherForecastByJil = JSON.Serialize(weatherForecast, Options.IncludeInherited);
Console.WriteLine("serialized JSON: " + serializedWeatherForecastByJil);