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
Abhilash J A
530
2.4k
600.5k
C# - If datetime return null show 'Unknown' message.
Dec 8 2016 10:16 AM
Hello everyone,
I have datatable that contain data like this
public
Nullable<DateTime> LogInTime {
get
;
set
; }
public
Nullable<DateTime> LogOutTime {
get
;
set
; }
LogInTime = m.Field<DateTime?>(
"LogInTime"
),
LogOutTime = m.Field<DateTime?>(
"LogOutTime"
)
And here I have a Linq query for, if LogOutTime is existing null return 'Unknown' message.
var logOutDate = (from A
in
logList select (A.LogOutTime.ToString() ??
"Unknown"
).ToString().Split(
new
[] {
' '
}, StringSplitOptions.RemoveEmptyEntries)).Distinct();
but getting empty string array in 'logOutDate' object.
How can I get
Unknown
messege if
LogOutTime
existing null value?
Reply
Answers (
1
)
How to Select and save photos ?
How to call methods of another Form from child window