Suppose I have an array of a custom class that takes a string and two ints:
public Statistic[] stats = new Statistic[]
{new Statistic("Health", 100, 100),
new Statistic("Stamina", 50, 50),
new Statistic("Attack", 5, 5),
new Statistic("Defend", 4, 4),
new Statistic("Speed", 3, 3),
new Statistic("Luck", 3, 3)};
I would love it if I could reference these elements through some kind of shorthand. For instance,
//referencing
stats.hp
//would point to the same data as
stats[0]
Is this a thing? My apologies if this has been asked before, I did some searching but I found it difficult to come up with a concise query. It’s really a readability thing that would be really nice to have. Thanks awfully for the help! -Luke