TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hadoop hadoop
NA
159
51.1k
set the default value of class property if it is null
May 25 2015 5:11 AM
I've a class. How to set default value of the class properties to "na" in case they are null.
public class PharmacyOrder
{
public class MedicineRecord
{
// how to set default value "na" for these properties
public string MedicineId { get; set; }
public string MedicineName { get; set; }
public string MedicineDealer { get; set; }
}
}
this MedicineRecord is called from another class.
public PharmacyOrder.MedicineRecord SetMedicineRecord()
{
PharmacyOrder.MedicineRecord obj = new PharmacyOrder.MedicineRecord();
obj.MedicineId = // assigned values
// for other properties too
}
how to set default value of the properties to "na" to assign default value when null is passed?
Reply
Answers (
5
)
how to calculate age using date of birth
textbox event