Is there a good reason not to use a delegate property here?

In this lesson, and in other places in GameDev.TV courses, a public method that returns a private property’s value is being used. Is there a compelling reason to use that instead of this?

public Unit SelectedUnit { get { return selectedUnit; } }

Or even better:

public Unit SelectedUnit => selectedUnit;

Welcome to the community @tdm.gamedev

Hugo wrote why he didn’t use it in this post.

Basically, it’s a personal preference, and you may certainly use your proposed method if you want. It makes no difference

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms