Click here to Skip to main content
15,796,299 members
Home / Discussions / C#
   

C#

 
Questionhow to use thread to control chart? Pin
smallkubi30-Nov-15 16:04
smallkubi30-Nov-15 16:04 
AnswerRe: how to use thread to control chart? Pin
Dave Kreskowiak30-Nov-15 17:05
mveDave Kreskowiak30-Nov-15 17:05 
QuestionUsing static var on a class Pin
Member 1217642830-Nov-15 5:59
Member 1217642830-Nov-15 5:59 
AnswerRe: Using static var on a class Pin
Dave Kreskowiak30-Nov-15 6:08
mveDave Kreskowiak30-Nov-15 6:08 
GeneralRe: Using static var on a class Pin
Member 1217642830-Nov-15 6:42
Member 1217642830-Nov-15 6:42 
AnswerRe: Using static var on a class Pin
Richard Deeming30-Nov-15 6:34
mveRichard Deeming30-Nov-15 6:34 
GeneralRe: Using static var on a class Pin
Member 1217642830-Nov-15 6:41
Member 1217642830-Nov-15 6:41 
AnswerRe: Using static var on a class Pin
OriginalGriff30-Nov-15 7:32
mvaOriginalGriff30-Nov-15 7:32 
The problem is that in this case, you aren't creating any instances of your class, just the variables to hold instances. If Program was a struct rather than a class, then
C#
Program b;
Program c;
would create instances - but they still wouldn't increment your counter, because value type constructions aren't implicitly called.

Try this:
C#
Program b = new Program();
Program c = new Program();
And your counter will be incremented as you expect because you are creating instances.

A variable isn't the same as an instance: think of a variable as a "parking space" - it can hold any Car object, but you can't drive the space down to the shops! The parking space is the variable, the instance is the actual Car it holds.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: Using static var on a class Pin
Richard Deeming30-Nov-15 7:40
mveRichard Deeming30-Nov-15 7:40 
AnswerThanks everyone,someone knows the answer for B. ? Pin
Member 1217642830-Nov-15 7:52
Member 1217642830-Nov-15 7:52 
GeneralRe: Thanks everyone,someone knows the answer for B. ? Pin
Eddy Vluggen30-Nov-15 8:11
professionalEddy Vluggen30-Nov-15 8:11 
GeneralRe: Thanks everyone,someone knows the answer for B. ? Pin
BillWoodruff30-Nov-15 10:09
professionalBillWoodruff30-Nov-15 10:09 
AnswerRe: Using static var on a class Pin
BillWoodruff30-Nov-15 10:17
professionalBillWoodruff30-Nov-15 10:17 
QuestionMy problem Pin
Member 1217509329-Nov-15 20:17
Member 1217509329-Nov-15 20:17 
AnswerRe: My problem Pin
BillWoodruff29-Nov-15 21:52
professionalBillWoodruff29-Nov-15 21:52 
Questionhow to use delegate to call function and introduce function as content? Pin
smallkubi29-Nov-15 19:31
smallkubi29-Nov-15 19:31 
AnswerRe: how to use delegate to call function and introduce function as content? Pin
BillWoodruff29-Nov-15 21:04
professionalBillWoodruff29-Nov-15 21:04 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
smallkubi29-Nov-15 21:42
smallkubi29-Nov-15 21:42 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
Pete O'Hanlon29-Nov-15 22:39
subeditorPete O'Hanlon29-Nov-15 22:39 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
BillWoodruff29-Nov-15 23:52
professionalBillWoodruff29-Nov-15 23:52 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
smallkubi30-Nov-15 3:27
smallkubi30-Nov-15 3:27 
AnswerRe: how to use delegate to call function and introduce function as content? Pin
Richard Deeming30-Nov-15 0:18
mveRichard Deeming30-Nov-15 0:18 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
smallkubi30-Nov-15 4:02
smallkubi30-Nov-15 4:02 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
Richard Deeming30-Nov-15 4:17
mveRichard Deeming30-Nov-15 4:17 
GeneralRe: how to use delegate to call function and introduce function as content? Pin
smallkubi30-Nov-15 5:24
smallkubi30-Nov-15 5:24 

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.