Click here to Skip to main content
16,011,680 members
Home / Discussions / C#
   

C#

 
GeneralRe: I can't draw a graph from serialport Data using zedgraph Pin
Luc Pattyn16-May-19 16:49
sitebuilderLuc Pattyn16-May-19 16:49 
AnswerRe: I can't draw a graph from serialport Data using zedgraph Pin
Jeff_T_123416-May-19 16:57
Jeff_T_123416-May-19 16:57 
QuestionWhy is this necessary? Pin
Brian_TheLion15-May-19 19:48
Brian_TheLion15-May-19 19:48 
AnswerRe: Why is this necessary? Pin
OriginalGriff15-May-19 20:05
mveOriginalGriff15-May-19 20:05 
GeneralRe: Why is this necessary? Pin
Brian_TheLion16-May-19 13:50
Brian_TheLion16-May-19 13:50 
GeneralRe: Why is this necessary? Pin
OriginalGriff16-May-19 20:14
mveOriginalGriff16-May-19 20:14 
GeneralRe: Why is this necessary? Pin
Brian_TheLion17-May-19 15:35
Brian_TheLion17-May-19 15:35 
GeneralRe: Why is this necessary? Pin
OriginalGriff17-May-19 20:09
mveOriginalGriff17-May-19 20:09 
If you do this:
C#
private void DoSummat()
   {
   Bird eagle = new Eagle();
   ...
   eagle = new Sparrow();
   ...
   }
You are just reusing the existing variable, like you do without worrying about classes:
C#
int i = 1;
while (true)
   {
   Console.WriteLine(i);
   i = i + 1;
   }
If you tried to create a new variable with the same name in the same scope:
C#
private void DoSummat()
   {
   Bird eagle = new Eagle();
   ...
   Bird eagle = new Sparrow();
   ...
   }
You would get an error as it already exists - just the same as you can't do this:
C#
for (int i = 0; i < 10; i++)
   {
   Console.Write($"{i} :");
   for (int i = 100; i < 110; i++)
      {
      Console.Write(i);
      }
   Console.WriteLine();
   }
You can't have two loop guards with the same name!
Or even this:
C#
private void DoSummat(int x)
   {
   int x = 666;
   ...
   }
Because the parameter and variable are the same name.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

AnswerRe: Why is this necessary? Pin
OriginalGriff15-May-19 21:32
mveOriginalGriff15-May-19 21:32 
GeneralRe: Why is this necessary? Pin
Brian_TheLion16-May-19 15:02
Brian_TheLion16-May-19 15:02 
GeneralRe: Why is this necessary? Pin
BillWoodruff17-May-19 15:18
professionalBillWoodruff17-May-19 15:18 
GeneralRe: Why is this necessary? Pin
OriginalGriff17-May-19 19:59
mveOriginalGriff17-May-19 19:59 
GeneralRe: Why is this necessary? Pin
jschell18-May-19 6:52
jschell18-May-19 6:52 
AnswerRe: Why is this necessary? Pin
Richard Deeming16-May-19 1:47
mveRichard Deeming16-May-19 1:47 
GeneralRe: Why is this necessary? Pin
OriginalGriff16-May-19 2:44
mveOriginalGriff16-May-19 2:44 
GeneralRe: Why is this necessary? Pin
Gerry Schmitz16-May-19 3:49
mveGerry Schmitz16-May-19 3:49 
GeneralRe: Why is this necessary? Pin
OriginalGriff16-May-19 3:55
mveOriginalGriff16-May-19 3:55 
GeneralRe: Why is this necessary? Pin
Richard MacCutchan16-May-19 4:03
mveRichard MacCutchan16-May-19 4:03 
GeneralRe: Why is this necessary? Pin
Gerry Schmitz16-May-19 5:02
mveGerry Schmitz16-May-19 5:02 
GeneralRe: Why is this necessary? Pin
Brian_TheLion16-May-19 19:12
Brian_TheLion16-May-19 19:12 
GeneralRe: Why is this necessary? Pin
Richard MacCutchan16-May-19 3:33
mveRichard MacCutchan16-May-19 3:33 
GeneralRe: Why is this necessary? Pin
Richard Deeming16-May-19 3:41
mveRichard Deeming16-May-19 3:41 
GeneralRe: Why is this necessary? Pin
Richard MacCutchan16-May-19 3:48
mveRichard MacCutchan16-May-19 3:48 
GeneralRe: Why is this necessary? Pin
Richard Deeming16-May-19 3:53
mveRichard Deeming16-May-19 3:53 
GeneralRe: Why is this necessary? Pin
Gerry Schmitz16-May-19 3:52
mveGerry Schmitz16-May-19 3:52 

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.