Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
C# - If datetime return null show 'Unknown' message.
Mani Kandan
Dec 8 2016 10:16 AM
212
Reply
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?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to Select and save photos ?
How to call methods of another Form from child window