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 8705139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:17:00+00:00 2026-06-13T03:17:00+00:00

I am receiving unreachable code detected in my properties. This worked for regular string

  • 0

I am receiving unreachable code detected in my properties. This worked for regular string fields but not for DateTime data type.

private DateTime m_RenewalDate;
    public DateTime M_RenewalDate
            {
                get { return m_RenewalDate != null ? m_RenewalDate : DateTime.MinValue; }
                set { m_RenewalDate = value; }
            }

this is my sqldatareader

reader.GetDateTime(reader.GetOrdinal("M_RENEWALDATE"))
  • 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-13T03:17:01+00:00Added an answer on June 13, 2026 at 3:17 am

    As driis said in his answer, m_RenewalDate == null is always false as DateTime is a value type and things declared to be value types cannot be null.

    To have the get the behavior of returning DateTime.MinValue from M_RenewalDate in the case that M_RENEWALDATE is null your reader code should look more like this

    object renewalDate = reader.GetValue(reader.GetOrdinal("M_RENEWALDATE"));
    
    if (Equals(renewalDate, DBNull.Value))
    {
        yourObject.M_RenewalDate = DateTime.MinValue;
    }
    else
    {
        yourObject.M_RenewalDate = (DateTime) renewalDate;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Receiving this error: Error 4 'ZoneUpdates.Models.PgeDataContext.PgeDataContext(string, System.Data.Linq.Mapping.MappingSource)' must declare a body because it is
I am receiving an error with this code. I am new to PHP but
I am receiving this Uncaught TypeError on a new website I am creating, but
Why am I receiving this Rake error: $ rake --version /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not
Im receiving this error when trying to compile my code. $ g++ -o BangBangControlTest
Im receiving this error The name 'Textbox1' does not exist in the current context
Im receiving error C2082: redefinition of formal parameter 'rval' in this code while trying
I am receiving this exception on XP running machine but on windows 7, there
I'm receiving a Resource interpreted as script but transferred with MIME type application/json error
I am receiving always a Failure in my cocos2d, but when I run this

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.