Hello All;

I'm not a student nor is this a project I am beginning a programming project of my own and redoing some of my personal lessons to refresh my understanding of C# and I couldn't believe how rusty I am until I hit this issue......

    using System;
    using System.Windows.Forms;

    namespace Monster
        private static String Name="Monster";
        int _currentLevel = 1;
        int _currentExperience = 0;
        int _nextLevelExperience = 1000;

        public static Monster(string name, int currentExperience)
            _name = name;
            _currentExperience = currentExperience;
        public string Name()

        public int CurrentExperience()
            return _currentExperience;

        public int NextLevelRequiredExperience()
            return _nextLevelExperience;
        public void LevelUp()
            Console.WriteLine(_name + ``has levelled up!``);
            _currentExperience = 0;
            _nextLevelExperience = _currentLevel * 1000;

    List<Monster>_monsterList = new List<Monster>();
    _monsterList.Add(new Monster("Ogre" , 1001));
    _monsterList.Add(new Monster("Skeleton", 999));
    _monsterList.Add(new Monster("Giant Bat", 1004));
    _monsterList.Add(new Monster("Slime", 0));

    // Select monsters that are about to level up
    Ienumerable<Monster> query = from min _monsterList
        where m.CurrentExperience() >
        orderby m.name() descending
        select m;
    foreach (Monster m in query)

I keep having a string error "A name space cannot directly contain members such as fields or methods" is the error message ---- I am TRYING to understand the error itself and the string problem again. I figured it out myself last time but I can't find the tutorial I was using last time.

Please help

I suspect you meant for Monster to be a class rather than a namespace.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.