In defense of using delegates instead of generic actions

I think in the video it should be mentioned the benefit of using named delegates with parameters instead of actions - It allows you to name these parameters, ie:

public event Action<float, float> onLevelUp;

vs

public delegate void LevelUpActionType(float currentLevel, float nextLevelExperience);
public event LevelUpActionType onLevelUp;

the second variant looks more descriptive and readable imho

2 Likes

Noted. Thanks.

(I still like Actions better. But yes, this is good to keep in mind.)

Privacy & Terms