Click here to Skip to main content
15,915,600 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid row value Pin
Stanciu Vlad24-Nov-05 9:29
Stanciu Vlad24-Nov-05 9:29 
QuestionFormatting Console.WriteLine Pin
budidharma24-Nov-05 8:03
budidharma24-Nov-05 8:03 
AnswerRe: Formatting Console.WriteLine Pin
Curtis Schlak.24-Nov-05 13:57
Curtis Schlak.24-Nov-05 13:57 
QuestionCode & Compiler Efficiency Pin
Andrew day24-Nov-05 7:28
Andrew day24-Nov-05 7:28 
AnswerRe: Code & Compiler Efficiency Pin
Colin Angus Mackay24-Nov-05 8:03
Colin Angus Mackay24-Nov-05 8:03 
AnswerRe: Code & Compiler Efficiency Pin
Colin Angus Mackay24-Nov-05 8:29
Colin Angus Mackay24-Nov-05 8:29 
AnswerRe: Code & Compiler Efficiency Pin
leppie24-Nov-05 20:16
leppie24-Nov-05 20:16 
QuestionHashTable Beginning Question Pin
budidharma24-Nov-05 7:27
budidharma24-Nov-05 7:27 
This is my first time working with hashtables. Here's what I'm trying to do, and what I need to do.

First, I have a HashTable that's initialized with the capacity of 169 (the number of possible pocket hands in holdem poker).

I deal two random cards to a player - and then create a string that looks like this, from the cards:
AKo, AKs, KKo, 32s ... etc. It'll always be in that format.

Now, I have a hashtable called HandCounter.

What I want to do, is check if that string exists as a "key" in the hash table. If it does, then get the value from that key and increment the value that is stored by 1. If it doesn't, then create a new key/value pair with the pocket string as the key and the int value 1.

Here's what I thought the code would probably look like:

if(HandCounter.ContainsKey(Hand.ToPocketString()))
{
HandCounter[Hand.ToPocketString()]++;
}
else
{
HandCounter.Add(Hand.ToPocketString(), 1);
}

Though something is wrong here. I'm attempting to use a string as the key, but it says it requires a type of "object" for the key. I'm attempting to use the value as an integer, but it says it uses type "object" as the value as well.

Do I need to typecast these?
AnswerRe: HashTable Beginning Question Pin
budidharma24-Nov-05 7:40
budidharma24-Nov-05 7:40 
GeneralRe: HashTable Beginning Question Pin
budidharma24-Nov-05 7:45
budidharma24-Nov-05 7:45 
Questionaccess controls in form1 from form2 Pin
Sam 200624-Nov-05 6:52
Sam 200624-Nov-05 6:52 
AnswerRe: access controls in form1 from form2 Pin
Robert Rohde24-Nov-05 7:08
Robert Rohde24-Nov-05 7:08 
GeneralRe: access controls in form1 from form2 Pin
Sam 200624-Nov-05 7:34
Sam 200624-Nov-05 7:34 
AnswerRe: access controls in form1 from form2 Pin
Curtis Schlak.24-Nov-05 14:16
Curtis Schlak.24-Nov-05 14:16 
GeneralRe: access controls in form1 from form2 Pin
Sam 200624-Nov-05 17:36
Sam 200624-Nov-05 17:36 
QuestionReflection, Breakpoints and Debug Mode Assembllies Pin
Tristan Rhodes24-Nov-05 5:58
Tristan Rhodes24-Nov-05 5:58 
AnswerRe: Reflection, Breakpoints and Debug Mode Assembllies Pin
leppie24-Nov-05 11:00
leppie24-Nov-05 11:00 
QuestionProblem with events Pin
sciamachy24-Nov-05 5:48
sciamachy24-Nov-05 5:48 
AnswerRe: Problem with events Pin
Leslie Sanford24-Nov-05 6:58
Leslie Sanford24-Nov-05 6:58 
QuestionTreeView question. Pin
zaboboa24-Nov-05 4:26
zaboboa24-Nov-05 4:26 
AnswerRe: TreeView question. Pin
Robert Rohde24-Nov-05 4:39
Robert Rohde24-Nov-05 4:39 
QuestionMethod parameters Pin
1nsp1r3d24-Nov-05 3:15
1nsp1r3d24-Nov-05 3:15 
AnswerRe: Method parameters Pin
Leslie Sanford24-Nov-05 3:40
Leslie Sanford24-Nov-05 3:40 
GeneralRe: Method parameters Pin
Colin Angus Mackay24-Nov-05 4:15
Colin Angus Mackay24-Nov-05 4:15 
AnswerRe: Method parameters Pin
Colin Angus Mackay24-Nov-05 4:25
Colin Angus Mackay24-Nov-05 4:25 

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.