Click here to Skip to main content
15,921,622 members
Home / Discussions / C#
   

C#

 
GeneralRe: Folder access Pin
.NetRocker28-Oct-05 4:59
.NetRocker28-Oct-05 4:59 
GeneralRe: Folder access Pin
Dave Kreskowiak28-Oct-05 5:03
mveDave Kreskowiak28-Oct-05 5:03 
GeneralRe: Folder access Pin
.NetRocker28-Oct-05 5:40
.NetRocker28-Oct-05 5:40 
GeneralRe: Folder access Pin
Dave Kreskowiak28-Oct-05 12:19
mveDave Kreskowiak28-Oct-05 12:19 
GeneralRe: Folder access Pin
.NetRocker31-Oct-05 4:01
.NetRocker31-Oct-05 4:01 
QuestionHow to avoid Outlook security warning programmatically Pin
we_swati27-Oct-05 8:16
we_swati27-Oct-05 8:16 
AnswerRe: How to avoid Outlook security warning programmatically Pin
Dave Kreskowiak27-Oct-05 8:24
mveDave Kreskowiak27-Oct-05 8:24 
GeneralRe: How to avoid Outlook security warning programmatically Pin
Robert M Greene27-Oct-05 9:28
Robert M Greene27-Oct-05 9:28 
QuestionE-Mails Moderator. Pin
Asare27-Oct-05 8:04
Asare27-Oct-05 8:04 
AnswerRe: E-Mails Moderator. Pin
Dave Kreskowiak27-Oct-05 14:26
mveDave Kreskowiak27-Oct-05 14:26 
AnswerRe: E-Mails Moderator. Pin
Christian Graus27-Oct-05 15:04
protectorChristian Graus27-Oct-05 15:04 
AnswerRe: E-Mails Moderator. Pin
Michael Hendrickx28-Oct-05 0:10
Michael Hendrickx28-Oct-05 0:10 
QuestionE-Mails Moderator. Pin
Asare27-Oct-05 8:03
Asare27-Oct-05 8:03 
QuestionHow to create Plug-in for an application Pin
Anindya Chatterjee27-Oct-05 7:00
Anindya Chatterjee27-Oct-05 7:00 
AnswerRe: How to create Plug-in for an application Pin
Gary Thom27-Oct-05 7:16
Gary Thom27-Oct-05 7:16 
QuestionEnums and Ints Pin
budidharma27-Oct-05 6:41
budidharma27-Oct-05 6:41 
AnswerRe: Enums and Ints Pin
whizzs27-Oct-05 8:56
whizzs27-Oct-05 8:56 
Whew, where to begin. First about the enums. I am assuming your Card class set method is structured as such: Card.Set ( Rank r, Suit s) and you have an array of Cards in deck[]. So to set your first card you would say deck[0].Set ( Rank.Hearts, Suit.Ace ).

Now the first problem is you have Rank and Suit mixed up, the Suit should be hearts, clubs, etc. Confusing to read.

Your second issue is your Card property Rank and Suit have the same name as your enum, that cannot be. I see what you are doing, you want to return that enum to set the next card with it, but you can't have the same name. I would change the name to CardRank and CardSuit and define the property like this:

//member variables
private Rank cardRank;
private Suit cardSuit;

//Properties
public Rank CardRank
{
set
{
cardRank = value;
}
get
{
return cardRank;
}
}
// do the same for CardSuit

now your swap functions will be:
tempCard.Set ( deck[first].CardRank, deck[first].CardSuit );

If you used integers in you Set function prototype then this won't work and you have to modify your properties to convert to integer or from integer depending on what your members are.

Your third issue is your last card will never get shuffled, Random returns a number less than the number passed in and your first and second could theoretcially be the same card (not a real problem, just wasted a shuffle)

If you want the integer value of an enum do this:
int x = (int) Rank.Clubs; //now x = 4
or
Rank r = Rank.Clubs;
int x = (int) r; //x = 4

finally if you want the string value:
string s = Rank.Clubs.ToString(); // s = "Clubs"
GeneralRe: Enums and Ints Pin
budidharma27-Oct-05 9:12
budidharma27-Oct-05 9:12 
GeneralRe: Enums and Ints Pin
budidharma27-Oct-05 9:28
budidharma27-Oct-05 9:28 
GeneralRe: Enums and Ints Pin
[Marc]27-Oct-05 12:29
[Marc]27-Oct-05 12:29 
GeneralRe: Enums and Ints Pin
whizzs28-Oct-05 3:38
whizzs28-Oct-05 3:38 
QuestionWindowses in C# Pin
Stanciu Vlad27-Oct-05 6:30
Stanciu Vlad27-Oct-05 6:30 
AnswerRe: Windowses in C# Pin
enjoycrack27-Oct-05 10:22
enjoycrack27-Oct-05 10:22 
AnswerRe: Windowses in C# Pin
Stanciu Vlad27-Oct-05 21:39
Stanciu Vlad27-Oct-05 21:39 
Questionproblem aborting a thread on shutdown Pin
Dan Neely27-Oct-05 6:01
Dan Neely27-Oct-05 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.