hello!
how to convert a null value into null object in C# ?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Anupam SinghRank #643 · 3.7K reputationPosted May 9, 2014, 11:23 PM EDT
My question to you :what is the need of doing this.It might be interesting if you share ..
is this what you were looking for
object o=(object)null;
dynamic d=(object)null;
Abhishek JaiswalRank #126 · 17.5K reputationPosted May 9, 2014, 11:42 PM EDT
i waana apply these 2 things over my code-
- refactoring
- null value into null object
can u please solve this.
(code is attached)
Anupam SinghRank #643 · 3.7K reputationPosted May 10, 2014, 1:11 AM EDT
you specified below method in Hospital Class :
But private ArrayList listOfDoctors; and private ArrayList listOfPatients; are global for Hospital class and its need not to use :
hospital.listOfDoctors.Add(new Doctor("Ben Casey", 32, 3, "Ear, Nose, Throat"));
you can simply use listOfDoctors.Add(new Doctor("Ben Casey", 32, 3, "Ear, Nose, Throat"));
for this or another methods.
and there is no need to specify these methods as static.
Abhishek JaiswalRank #126 · 17.5K reputationPosted May 10, 2014, 10:37 AM EDT
can u please tell me how to do with other code parts like
patient.cs and other.