Decabytes
CatAPI Json deserialization issue.
I'm having trouble getting my code to deserialize my json correctly. When I run my Program.cs I get
But I'm not able to access the fields in the json.
My Program.cs
my Json class
the response
my function
Does anyone know what I'm doing wrong?
10 replies
❔ Class method construction using lambda?
I was looking at some Avalonia code and I noticed this code
internal class Database
{
public IEnumerable<TodoItem> Get
public IEnumerable<TodoItem> GetItems() => new[]
{
new TodoItem{Description = "Walk the dog" },
new TodoItem{Description = "Buy some milk"},
new TodoItem{Description = "Learn Avalonia", isChecked = true }
};
I'm confused about the => new[] part. If the method had just been
public IEnumerable<TodoItem> GetItems()
{
new TodoItem{Description = "Walk the dog" },
new TodoItem{Description = "Buy some milk"},
new TodoItem{Description = "Learn Avalonia", isChecked = true }
};
I wouldn't have batted an eye. Does => new[] just mean collect the results in a curly brace into an array? What is this feature called?
8 replies