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
Thakerng Kruabkonto
NA
91
1.6k
How to assign value to DateTime? field of object.
Jul 22 2019 11:56 PM
I have declared Person class as below.
public class Person
{
public string Prefix { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
}
I create an Person object.
Person _person = new Person { Prefix = "Mr", FirstName = "William", LastName = "Jonathan", DateOfBirth = DateTime.Now.AddYears(-29) };
Problem --> I got an error "Object reference not set to an instance of an object." in setting value to DateOfBirth.
Anybody help me? How to solved it?
Thank you.
Thakerng.
Reply
Answers (
4
)
sql server login error
Url Routing in asp.net