/Hi I was wondering what I need to do to get this for loop to cycle through my enums, as it doesn't take [].I am attempting to create all the cards in a deck of cards./
using System;
using System.Collections.Generic;
using System.Text;
namespace BlackJackGameX
{
public class Deck
{
Random rNumber = new Random();
List<Card> Cards;
List<Card> ShuffledDeck;
public Deck ()
{
Cards = NewDeck();
}
public void Shuffle()
{
for (int i = 0; i <= 51; ++i)
{
int c = rNumber.Next (1, 53);
ShuffledDeck.Add(Cards[c]);
}
}
/This is the main problem area, I think I have made a mistake in my constructer as well but that is probably an unrelated issue/
private List<Card> NewDeck(Suit CardSuit, FaceValue CardValue, int iValue)
{
for (int i = 0; i <= 3; i++)
{
for (int j = 0; j <= 12; j++)
{
Card newCard = new Card(CardSuit[i], CardValue[j], iValue[j]);
}
}
}
public void Print()
{
Console.WriteLine(ShuffledDeck[1].CardValue);
Console.ReadLine();
}
}
}
/*This is the other class containing the enums*/
using System;
using System.Collections.Generic;
using System.Text;
namespace BlackJackGameX
{
public enum Suit {Spades, Hearts, Clubs, Diamonds}
public enum FaceValue {Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King}
public class Card
{
public Suit CardSuit;
public FaceValue CardValue;
public int iValue;
public Card (Suit cardSuit, FaceValue cardValue, int ivalue)
{
CardSuit = cardSuit;
CardValue = cardValue;
iValue =ivalue;
}
public Card ()
{
}
}
}