© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
18 replies
phattanuki

Should you assert input arguments ins

Why am I getting a null-reference error here?

namespace Joust_.Manager {
    public static class GenerateSkillList {
        public static List<ISkill> AllSkills { get; } = GenerateSkillList.Setup();
        private static List<ISkill> Setup() {
            //do I have a better way to do this?
            AllSkills.Add(new Skills.Attack());
            AllSkills.Add(new Skills.Defend());
            AllSkills.Add(new Skills.Warcry());
            AllSkills.Add(new Skills.ThrowSmellyCheese());
            return AllSkills;
        }
    }
}
namespace Joust_.Manager {
    public static class GenerateSkillList {
        public static List<ISkill> AllSkills { get; } = GenerateSkillList.Setup();
        private static List<ISkill> Setup() {
            //do I have a better way to do this?
            AllSkills.Add(new Skills.Attack());
            AllSkills.Add(new Skills.Defend());
            AllSkills.Add(new Skills.Warcry());
            AllSkills.Add(new Skills.ThrowSmellyCheese());
            return AllSkills;
        }
    }
}
unknown.png
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

✅ Main program input arguments
C#CC# / help
17mo ago
Assert.Raises<> in xUnit
C#CC# / help
3y ago
❔ Should you commit .idea?
C#CC# / help
4y ago
xUnit: Can't assert exceptions
C#CC# / help
3y ago