How many properties does this lookup print?

from Reflection
C# 14 / .NET 10 beginner 2 min

How many properties does this lookup print?

csharp
using System;
using System.Reflection;

BindingFlags flags = BindingFlags.Public
    | BindingFlags.Instance
    | BindingFlags.DeclaredOnly;

Console.WriteLine(typeof(Invoice).GetProperties(flags).Length);

public class Document
{
    public string Code { get; init; } = "";
}

public sealed class Invoice : Document
{
    public decimal Total { get; init; }
}
Open in playground
Report an error