Doug Chamberlain
Doug Chamberlain

Reputation: 11341

In C# what does this syntax do and what is it called?

I'm guessing this is saying the Constructor for OrderRepository passes its parameter to the base constructor?

public OrderRepository(MFEntitiesContainer context) : base(context) { }

Upvotes: 1

Views: 103

Answers (2)

Oded
Oded

Reputation: 498904

This is called constructor chaining - you are chaining the constructor to the base constructor overload.

As you assume, it passes the parameter to the matching base class constructor.

Upvotes: 5

Daniel A. White
Daniel A. White

Reputation: 190897

Correct. Its calling the "base constructor".

See this page on constructors.

http://msdn.microsoft.com/en-us/library/ms173115(v=VS.100).aspx

Upvotes: 5

Related Questions