0

When I try the code below, I get a message that "the name C does not exist in the current context." What am I missing here? I would like the position part in the dictionary to behave just like the other variables, but I've been having trouble using the enum. Thanks!

class stats
    {
        enum pos { fiB, seB, SS, thB, LF, CF, RF, C, DH, SP, RP };
        public double age {get; set;}
        public pos position{get; set;}
        public double ovalue{get; set;}
        public double dvalue{get; set;}
    }
    public partial class playerdictionary:stats
    {
        public playerdictionary()
        {
            var dict = new Dictionary<string, stats>();
            dict.Add("AG", new stats { age = 24, position=C, ovalue = 0, dvalue = 4.2 });

        }
1
  • 3
    Have you tried pos.C? Commented Aug 1, 2013 at 18:11

2 Answers 2

6

You're missing the enum's name pos.

position = pos.C;
//         ^^^^
Sign up to request clarification or add additional context in comments.

Comments

2

It should read:

position = pos.C

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.