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

  • Home
  • SEARCH
  • 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 9176039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:00:59+00:00 2026-06-17T17:00:59+00:00

We are trying to override the DateTime.MinValue in our application, but by doing it

  • 0

We are trying to override the DateTime.MinValue in our application, but by doing it we noticed that our Web services are timing-out, following is a sample code. Not sure what is wrong/what we are missing.

 public MainWindow()
 {
     //Introducing this.. Causes timeout of the webservice call...
     typeof(DateTime).GetField("MinValue").SetValue(typeof(DateTime),new DateTime(1900, 1, 1));
     var yesitworks= DateTime.MinValue;
     InitializeComponent();
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     //Below call will timeout...
     var value =client.GetData(10);
}

PS: This might not be the best solution for what we are trying resolve but now its more of curiosity as to why it is not working? how is it related.

  • 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-06-17T17:01:00+00:00Added an answer on June 17, 2026 at 5:01 pm

    DateTime.MinValue is a static readonly field. That means that library authors will not expect it to change, and may write code that depends on it having the expected value.

    Hence, you should not change the value of DateTime.MinValue.

    For example, a library may use it as the default value for a variable:

    private mostRecentDate= DateTime.MinValue;
    foreach (var date in myDates)
    {
        if (date > mostRecentDate)
        {
            mostRecentDate= date;
        }
    }
    
    // Do something with the most recent date in myDates...
    

    In this example, if myDates only contained dates earlier than your new value for DateTime.MinValue, then this code would set mostRecentDate to DateTime.MinValue rather than the latest date in myDates.

    While this rather contrived example may not be good programming practise (for example, you could use Nullable instead), it is valid code, whose behaviour would be changed if you changed the value of DateTime.MinValue.

    The point is that libraries you are using could also be dependant on the value on DateTime.MinValue, so changing it could break them. You are llucky in so far as you found out that this introduced a bug early. If you are unlucky, you would not see a problem until your software had gone live and some corner case was hit.

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

Sidebar

Related Questions

im trying to override the add() but it will not compile public class AVLTree<E
I've been trying to override the file login.xml but no matter what I try,
I'm trying to override operator < as the following : inside Node : bool
I am trying to override the DateTime template since I need custom class names
Following Python's documentation , I'm trying to override logging.Formatter.converter in order to control the
Trying to override a tostring in one of my classes. return string.Format(@ name =
I'm trying to override a JSP in Liferay 6.1, namely html/portlet/enterprise_admin/settings/authentication.jsp. I have created
I'm trying to override a method inside a jquery widget. The method can be
If I am trying to override a specific tag inside multiple classes, do I
I'm trying to override the window.confirm in ExtJS 4. The override should return either

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.