Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:34+00:00 2026-05-23T13:29:34+00:00

If a DateTime instance has not been assigned yet, what is it’s value? To

  • 0

If a DateTime instance has not been assigned yet, what is it’s value?

To look at a specific example: In the class below, would “UnassignedDateTime==null” return true?

And if so, surely it is massively illogical that such a reference could be null, but not assigned null?

class TestClass
{
    public DateTime AssignedDateTime {get; set;}
    public DateTime UnassignedDateTime {get; set;}

    public TestClass()
    {
        AssignedDateTime=DateTime.Now;
        //Not assigning other property
    }

}

I’ve already checked this answer to a similar question, but it’s about DateTime? which is nullable.. How to check if DateTime object was not assigned?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:29:34+00:00Added an answer on May 23, 2026 at 1:29 pm

    It will be default(DateTime) which by a design-decision happens to be DateTime.MinValue

    default(T) is what types are initialized to when used as fields or array members.
    default(int) == 0, default(bool) == false etc.
    The default for all reference types is of course null.

    It is legal to write int i = default(int); but that’s just a bit silly. In a generic method however, T x = default(T); can be very useful.

    surely it is massively illogical that such a reference could be null, but not assigned null?

    DateTime is a Value-type, (struct DateTime { ... }) so it cannot be null. Comparing it to null will always return false.

    So if you want find out the assigned status you can compare it with default(DateTime) which is probably not a valid date in your domain. Otherwise you will have to use the nullable type DateTime?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a specific DateTime value, how do I display relative time, like: 2 hours
PHP's DateTime class has the two methods add() and sub() to add or subtract
I have a Priority class that has a datetime column. This column has a
I am defining a class which has a DateTime object as one of the
Given a datetime.time value in Python, is there a standard way to add an
For example: from datetime import <c-x><c-o>{list of modules inside datetime package}
The root problem: I have an application which has been running for several months
Apparently Range has a method that checks if it contains a value of type
Variable resp has following value. System.Xml.Linq.XElement resp - How do I get value of
I am new to SQL, and could not find out how to make below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.