C
C#2y ago
LukeJ

❔ Inconsistent accessibility [Answered]

I have this bit of code here
enum UnitName {
Warrior,
Archer,
Cleric
}

public readonly record struct Unit(char indicator, int cost, int damage, int hp, int range);

public static class Units {
public static readonly Map<UnitName, Unit> all = Map(
(UnitName.Warrior, new Unit('x', 15, 4, 9, 1)),
(UnitName.Archer, new Unit('x', 20, 2, 5, 4)),
(UnitName.Cleric, new Unit('x', 30, 1, 3, 6))
);
}
enum UnitName {
Warrior,
Archer,
Cleric
}

public readonly record struct Unit(char indicator, int cost, int damage, int hp, int range);

public static class Units {
public static readonly Map<UnitName, Unit> all = Map(
(UnitName.Warrior, new Unit('x', 15, 4, 9, 1)),
(UnitName.Archer, new Unit('x', 20, 2, 5, 4)),
(UnitName.Cleric, new Unit('x', 30, 1, 3, 6))
);
}
And I cannot for the life of me figure out why it gives me the error Inconsistent accessibility: field type 'Map<UnitName, Unit>' is less accessible than field 'Units.all. Map is just an immutable dictionary from Language.Ext (https://louthy.github.io/language-ext/LanguageExt.Core/Immutable%20Collections/Map/index.html) Any ideas?
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LukeJ
LukeJ2y ago
Aaaaaah, thanks. I think I misremembered them always being effectively static as them always being public 😅 It still amuses me how beginner mistakes will never stop cropping up and stumping me from time to time.
Accord
Accord2y ago
✅ This post has been marked as answered! Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.