base

noun

say it: “BAYS” /beɪs/

The C# keyword a derived class uses to reach its base class, to call its constructor or its version of a method.

What is base in C#?

base — The keyword a derived class uses to reach its base class. : base(...) after a constructor passes values up to the base constructor, and base.Method() runs the base class's version of a method you've overridden.

class Ebook : Book
{
    public Ebook(string title, int fileSizeMb) : base(title)
    {
        FileSizeMb = fileSizeMb;
    }
    public int FileSizeMb { get; }
}

In a sentence

  • “The Ebook constructor passes the title up with : base(title).”

Level: Journeyman · More C# terms at this level

Updated