© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
5 replies
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
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?
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

Inconsistent accessibility parameter
C#CC# / help
16mo ago
CS0050: Inconsistent Accessibility
C#CC# / help
17mo ago
✅ Inconsistent accessibility??? Avalonia C#
C#CC# / help
2y ago
Decreasing a property accessibility [Answered]
C#CC# / help
4y ago