Click here to Skip to main content
14,138,256 members
   

C#

 
AnswerRe: I can't draw a graph from serialport Data using zedgraph Pin
Luc Pattyn16-May-19 4:25
professionalLuc Pattyn16-May-19 4:25 
GeneralRe: I can't draw a graph from serialport Data using zedgraph Pin
Jeff_T_123416-May-19 16:42
memberJeff_T_123416-May-19 16:42 
GeneralRe: I can't draw a graph from serialport Data using zedgraph Pin
Luc Pattyn16-May-19 16:45
professionalLuc Pattyn16-May-19 16:45 
GeneralRe: I can't draw a graph from serialport Data using zedgraph Pin
Jeff_T_123416-May-19 16:47
memberJeff_T_123416-May-19 16:47 
GeneralRe: I can't draw a graph from serialport Data using zedgraph Pin
Luc Pattyn16-May-19 16:49
professionalLuc 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
memberJeff_T_123416-May-19 16:57 
QuestionWhy is this necessary? Pin
Brian_TheLion15-May-19 19:48
memberBrian_TheLion15-May-19 19:48 
AnswerRe: Why is this necessary? Pin
OriginalGriff15-May-19 20:05
protectorOriginalGriff15-May-19 20:05 
So that C# "knows" what kind of objects can be put in it!
Remember that a variable can contain an instance of the type it was declared as, plus any derived types.
So is you have a class hierarchy:
class Animal {}
class Mammal : Animal {}
class Birds : Animal {}
class Fish : Animal {}
class Reptiles : Animal {}
class Amphibian : Animal {}
class Fox : Mammal {}
Then declaring createurs is legal:
Fox fox = new Fox();
And
Mammal mammal = new Fox();
And so is this:
Bird eagle = new Eagle();
And you can do this:
Animal animal = fox;
animal = eagle;
animal = mammal;
But you can't do this:
eagle = fox;
Or this:
eagle = mammal;
Or even:
fox = eagle;
Because they don't make any sense in a real world.

Telling C# what type of object a variable can contain means it can catch errors at compile time instead of when your program is running, which makes your code both easier to read and more reliable.
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!

GeneralRe: Why is this necessary? Pin
Brian_TheLion16-May-19 13:50
memberBrian_TheLion16-May-19 13:50 
GeneralRe: Why is this necessary? Pin
OriginalGriff16-May-19 20:14
protectorOriginalGriff16-May-19 20:14 
GeneralRe: Why is this necessary? Pin
Brian_TheLion17-May-19 15:35
memberBrian_TheLion17-May-19 15:35 
GeneralRe: Why is this necessary? Pin
OriginalGriff17-May-19 20:09
protectorOriginalGriff17-May-19 20:09 
AnswerRe: Why is this necessary? Pin
OriginalGriff15-May-19 21:32
protectorOriginalGriff15-May-19 21:32 
GeneralRe: Why is this necessary? Pin
Brian_TheLion16-May-19 15:02
memberBrian_TheLion16-May-19 15:02 
GeneralRe: Why is this necessary? Pin
BillWoodruff17-May-19 15:18
mveBillWoodruff17-May-19 15:18 
GeneralRe: Why is this necessary? Pin
OriginalGriff17-May-19 19:59
protectorOriginalGriff17-May-19 19:59 
GeneralRe: Why is this necessary? Pin
jschell18-May-19 6:52
memberjschell18-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
protectorOriginalGriff16-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
protectorOriginalGriff16-May-19 3:55 
GeneralRe: Why is this necessary? Pin
Richard MacCutchan16-May-19 4:03
protectorRichard 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
memberBrian_TheLion16-May-19 19:12 
GeneralRe: Why is this necessary? Pin
Richard MacCutchan16-May-19 3:33
protectorRichard MacCutchan16-May-19 3:33 

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.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190518.1 | Last Updated 22 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid