A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
537 B

using System;
using System.IO;
using System.Text.Json;
namespace VirtualizationDemo.Models;
public class ChatFile
{
public ChatMessage[]? Chat { get; set; }
public static ChatFile Load(string path)
{
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
using var s = File.OpenRead(path);
return JsonSerializer.Deserialize<ChatFile>(s, options)!;
}
}
public record ChatMessage(string Sender, string Message, DateTimeOffset Timestamp);