© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
15 replies
robs0271

Explanation of the Value parameter in Class constructor

Hello! I am following tutorials on Game Dev with C# and MonoGame to improve and practice my basic OOP programming knowledge with C#.
I am trying to understand which is the meaning of "value" in the following, which I suppose to be a constructor:

public ContentManager Content
{
get
{
return _content;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
_content = value;
}
}

The class constructor pasted above is inside the class Game : IDisposable that comes from the Microsoft.Xna.Framework.
Specifically, I don't understand where the "value" comes from and how it is handled, as it seems to me to be a parameter passed inside such a class constructor:
At the same time, the constructor seems parameterless to me, as there is no () after the name of the constructor... I suppose I am missing some OOP key concepts in this regard; please help me to understand 🙂

More in general, this "Content {get;set;}" is called to load the content inside the game, in the LoadContent method of the Game.cs:

protected override void LoadContent()
{
target = Content.Load<Texture2D>("target");
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

class constructor in c#
C#CC# / help
12mo ago
❔ ✅ class parameter
C#CC# / help
4y ago
Default parameter values in primary constructor
C#CC# / help
3y ago
Can someone give me a explanation of a Constructor?
C#CC# / help
5mo ago