Код: Выделить всё
public record Point
{
public int X { get; init; }
public int Y { get; init; }
[JsonConstructor]
public Point(string point)
{
var m = Regex.Match(point, @"(\d+),(\d+)");
X = int.Parse(m.Groups[0].Value);
Y = int.Parse(m.Groups[1].Value);
}
public override string ToString()
{
return $"{X},{Y}";
}
}
Есть ли простой способ сделать это наоборот, т.е. сериализовать Point с помощью метода ToString()?
Подробнее здесь: https://stackoverflow.com/questions/788 ... ialization
Мобильная версия