XNA Creators Club Online
Page 1 of 1 (8 items)
Sort Posts: Previous Next

Enum problem

Last post 10/25/2009 7:48 PM by Silvermax. 7 replies.
  • 10/25/2009 6:32 PM

    Enum problem

    I have finally managed to get the connection working with my XBOX but now have a problem with my game.

    Here is the code that gives me the error:

                foreach (Suit suit in Enum.GetValues(typeof(Suit)))  
                {  
                    foreach (FaceValue facevalue in Enum.GetValues(typeof(FaceValue)))  
                    {  
     
                    }  
                } 

    I get the error message: 'System.Enum' does not contain a definition for 'GetVaues'

    Does anyone know a work around of this which will work with the XBOX as the above code works fine on windows.
    Speed - Now Available For Download
  • 10/25/2009 6:42 PM In reply to

    Re: Enum problem

    Answer
    Reply Quote
    The .NET in xbox 360 is a "compact version" which means doesn't have all the libraries available in the PC.
    Kaotik Puzzle now on the marketplace.
    twitter, facebook, youtube
  • 10/25/2009 6:49 PM In reply to

    Re: Enum problem

    Answer
    Reply Quote
    Even though Enum.GetValues() doesn't exist on the Xbox, you could just create a List of all the values in your enum (possibly in a static class or as an extention method for convienience), and foreach threw that. However, you would have to manually add each value in your enum to your List (or use a for loop and cast the type the enum uses to store the value to the enum value).
  • 10/25/2009 7:05 PM In reply to

    Re: Enum problem

    Answer
    Reply Quote
    See this (now ancient) thread which offers numerous solutions to the lack of Enum.GetValues on Xbox: http://forums.xna.com/forums/p/1610/157478.aspx.

    And Silvermax, please consider removing the image from your signature. There is nothing preventing you from having it, but we prefer people stick to text-only signatures. Thanks. :)
  • 10/25/2009 7:11 PM In reply to

    Re: Enum problem

    Nick Gravelyn:
    See this (now ancient) thread which offers numerous solutions to the lack of Enum.GetValues on Xbox: http://forums.xna.com/forums/p/1610/157478.aspx.

    And Silvermax, please consider removing the image from your signature. There is nothing preventing you from having it, but we prefer people stick to text-only signatures. Thanks. :)
    No problem!
    Kaotik Puzzle now on the marketplace.
    twitter, facebook, youtube
  • 10/25/2009 7:15 PM In reply to

    Re: Enum problem

    Answer
    Reply Quote
    I recently ran into this, and there is a workaround. See this thread.

    Note that it was the first entry here. :)

    [edit]: wow, ninja'd again. Must hit F5 more frequently. ;)
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 10/25/2009 7:35 PM In reply to

    Re: Enum problem

    Answer
    Reply Quote
    Yes, this is annoying! The best option I know is to declare a matching string array:

      enum Suit { Clubs, Diamonds, Hearts, Spades };
      static string[] SuitValueName = new string [] { "Clubs", "Diamonds", "Hearts", "Spades" };
    

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 10/25/2009 7:48 PM In reply to

    Re: Enum problem

    I just keep manually a counter.

    When i add an enum value, i update the counter.

    enum Suit { Clubs, Diamonds, Hearts, Spades };
    const int suitCount = 4;
    Kaotik Puzzle now on the marketplace.
    twitter, facebook, youtube
Page 1 of 1 (8 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG