Csharp 12

De Banane Atomic
Aller à la navigationAller à la recherche

Links

Primary constructors

Cs.svg
public class Item
{
    public readonly string Name { get; }

    public Item (string name)
    {
        Name = name;
    }
}

// equivalent with a primary constructor
public class Item(string name)
{
    public readonly string Name { get; } = name;
}