Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
AnswerRe: [C#] Diffirent between thread and timer Pin
Eddy Vluggen8-Jun-20 1:25
professionalEddy Vluggen8-Jun-20 1:25 
QuestionNeed help calling a static method Pin
Member 148563427-Jun-20 15:00
Member 148563427-Jun-20 15:00 
AnswerRe: Need help calling a static method Pin
OriginalGriff7-Jun-20 20:29
mveOriginalGriff7-Jun-20 20:29 
QuestionCard shuffle program code help needed Pin
Brian_TheLion7-Jun-20 3:57
Brian_TheLion7-Jun-20 3:57 
AnswerRe: Card shuffle program code help needed Pin
Dave Kreskowiak7-Jun-20 4:03
mveDave Kreskowiak7-Jun-20 4:03 
GeneralRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 4:14
mveOriginalGriff7-Jun-20 4:14 
GeneralRe: Card shuffle program code help needed Pin
Dave Kreskowiak7-Jun-20 8:05
mveDave Kreskowiak7-Jun-20 8:05 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion8-Jun-20 19:17
Brian_TheLion8-Jun-20 19:17 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion7-Jun-20 15:27
Brian_TheLion7-Jun-20 15:27 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard MacCutchan7-Jun-20 21:51
mveRichard MacCutchan7-Jun-20 21:51 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion8-Jun-20 19:15
Brian_TheLion8-Jun-20 19:15 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard MacCutchan8-Jun-20 21:30
mveRichard MacCutchan8-Jun-20 21:30 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard Deeming8-Jun-20 0:08
mveRichard Deeming8-Jun-20 0:08 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion8-Jun-20 19:01
Brian_TheLion8-Jun-20 19:01 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard Deeming8-Jun-20 22:16
mveRichard Deeming8-Jun-20 22:16 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion11-Jun-20 18:20
Brian_TheLion11-Jun-20 18:20 
AnswerRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 4:11
mveOriginalGriff7-Jun-20 4:11 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion7-Jun-20 15:37
Brian_TheLion7-Jun-20 15:37 
GeneralRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 20:38
mveOriginalGriff7-Jun-20 20:38 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion8-Jun-20 19:12
Brian_TheLion8-Jun-20 19:12 
GeneralRe: Card shuffle program code help needed Pin
F-ES Sitecore9-Jun-20 2:31
professionalF-ES Sitecore9-Jun-20 2:31 
That's just the basic type info for what you're hovering over. When you hover over deck1 it shows the info for that object. If you want to know what "deck1[x]" is then you can highlight the whole string including the square brackets, right click and select "Quick Watch" from the context menu.

Another debugging tip is that compound statements like this

C#
Console.Write("0-19)", deck1.DealCard());


are harder to debug. While still in the coding process it will often help to split things up into individual lines

C#
Card card = deck1.DealCard();
Console.Write("0-19)", card);


You can now inspect "card" to see what DealCard has returned. If it looks like what you expect then you know it is the Console.Write that isn't doing what you expect. By splitting the code into two separate stages you can test them separately...you can test DealCard is doing what you want, then Console.Write. With your original code you are doing two things at once so it is harder to know which of those things is failing. Once you have your bugs ironed out and the code working, you can go back to the code in line if you wish.

The reason your Console.Write isn't working is because you are using the two param method, so the first param ("0-19)") is the "format" and the second param ("card") is the data you want to show in that format. However "0-19)" is not a proper formatting string so all you will get is that text out verbatim. A formatting string has placeholders for the values, so {0} for the first param, {1} for the second etc.

To see this in action try;

C#
Card card = deck1.DealCard();
Console.Write("card {0} = {1} ", i, card);

GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion9-Jun-20 19:56
Brian_TheLion9-Jun-20 19:56 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion11-Jun-20 18:17
Brian_TheLion11-Jun-20 18:17 
QuestionBest way to store methods in a database? Pin
arnold_w5-Jun-20 22:42
arnold_w5-Jun-20 22:42 
QuestionRe: Best way to store methods in a database? Pin
Richard MacCutchan5-Jun-20 22:58
mveRichard MacCutchan5-Jun-20 22:58 

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.