Click here to Skip to main content
15,924,581 members
Home / Discussions / C#
   

C#

 
AnswerRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
alexey N11-May-06 17:31
alexey N11-May-06 17:31 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59211-May-06 17:48
kayos59211-May-06 17:48 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
alexey N11-May-06 17:55
alexey N11-May-06 17:55 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59211-May-06 18:10
kayos59211-May-06 18:10 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59211-May-06 18:28
kayos59211-May-06 18:28 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
mav.northwind11-May-06 20:39
mav.northwind11-May-06 20:39 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59212-May-06 4:04
kayos59212-May-06 4:04 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
Office Lineman12-May-06 6:51
Office Lineman12-May-06 6:51 
The root of your design problem is that you have declared a Patient class that holds an array of what would be properly conceived as individual patient instances. Your code has a severe readability issue and violates object-oriented design principles. If you're going to use that class to hold 5 static people, then a class called PatientList would indicate your intent more clearly. Save the obfuscation for later.

An approach that would be more reasonable from an OOD standpoint would be to create a class called Patient that encapsulates each individual patient's ID, first, middle, and last names, and then use the PatientList class to maintain an array of Patient objects.

Also, your use of static is highly questionable. Unless your goal is to ensure that there is only one list of patients--ever--then there's no reason not to use member fields and instantiate a single patient list.

Finally... yes, read books. I don't think the CP community is necessarily trying to insult or demean when making this suggestion. There's no reason to get started off in programming on the wrong foot. It's apparently obvious from the nature of the original question that you don't have a solid grasp on C#'s object fundamentals and object-oriented design.

These basics are going to be necessary if you ever plan on moving past "Hello, World!" and becoming a leader. Leaders are successful and secure. Followers are a dime a dozen and can easily be replaced by someone willing to do the work for half the price.

--
I've killed again, haven't I?
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59212-May-06 11:35
kayos59212-May-06 11:35 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
Office Lineman12-May-06 11:49
Office Lineman12-May-06 11:49 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59213-May-06 13:48
kayos59213-May-06 13:48 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
Office Lineman14-May-06 3:51
Office Lineman14-May-06 3:51 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
alexey N11-May-06 18:29
alexey N11-May-06 18:29 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59211-May-06 18:31
kayos59211-May-06 18:31 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
Pavel Vladov11-May-06 21:29
Pavel Vladov11-May-06 21:29 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
kayos59212-May-06 3:48
kayos59212-May-06 3:48 
GeneralRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
Pavel Vladov12-May-06 8:07
Pavel Vladov12-May-06 8:07 
AnswerRe: Basic C# - Object Reference Not Set To Instance of An Object Pin
nikeshkumar11-May-06 19:19
nikeshkumar11-May-06 19:19 
QuestionLoopBack Pin
picasso211-May-06 15:29
picasso211-May-06 15:29 
AnswerRe: LoopBack Pin
led mike11-May-06 15:56
led mike11-May-06 15:56 
GeneralRe: LoopBack Pin
leppie11-May-06 22:06
leppie11-May-06 22:06 
GeneralRe: LoopBack Pin
led mike12-May-06 5:10
led mike12-May-06 5:10 
QuestionRe: LoopBack Pin
Matt Newman11-May-06 19:16
Matt Newman11-May-06 19:16 
AnswerRe: LoopBack Pin
picasso214-May-06 8:57
picasso214-May-06 8:57 
GeneralRe: LoopBack Pin
Matt Newman15-May-06 10:34
Matt Newman15-May-06 10:34 

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.