mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
Add starter project for Chapter 13
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace UnoMediaCollection.DataContracts.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// Generated class for System.Text.Json Serialization
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When using the JsonSerializerContext you must add the JsonSerializableAttribute
|
||||
/// for each type that you may need to serialize / deserialize including both the
|
||||
/// concrete type and any interface that the concrete type implements.
|
||||
/// For more information on the JsonSerializerContext see:
|
||||
/// https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation?WT.mc_id=DT-MVP-5002924
|
||||
/// </remarks>
|
||||
[JsonSerializable(typeof(WeatherForecast))]
|
||||
[JsonSerializable(typeof(WeatherForecast[]))]
|
||||
[JsonSerializable(typeof(IEnumerable<WeatherForecast>))]
|
||||
[JsonSerializable(typeof(IImmutableList<WeatherForecast>))]
|
||||
[JsonSerializable(typeof(ImmutableList<WeatherForecast>))]
|
||||
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
|
||||
public partial class WeatherForecastContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
namespace UnoMediaCollection.DataContracts
|
||||
{
|
||||
/// <summary>
|
||||
/// A Weather Forecast for a specific date
|
||||
/// </summary>
|
||||
/// <param name="Date">Gets the Date of the Forecast.</param>
|
||||
/// <param name="TemperatureC">Gets the Forecast Temperature in Celsius.</param>
|
||||
/// <param name="Summary">Get a description of how the weather will feel.</param>
|
||||
public record WeatherForecast(DateOnly Date, double TemperatureC, string? Summary)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Forecast Temperature in Fahrenheit
|
||||
/// </summary>
|
||||
public double TemperatureF => 32 + (TemperatureC * 9 / 5);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user