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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:57:15+00:00 2026-05-16T23:57:15+00:00

we identify client software using Version class and use these values extensively, we also

  • 0

we identify client software using Version class and use these values extensively, we also store these values in database. How would you store unknown version value? We can get unknown version value if we wasn’t able to successfully query client version.

I ask because I’m fond of Null object pattern, I don’t like constant checks for null, and I wish that Version type was a value-type instead of reference-type. But Microsoft implemented Version type as reference-type. At the same time, in .NET v4 they added TryParse() method, which in case of failure saves result as (0,0) but not Null. If you call default constructor without providing exact version value, you would get (0,0) value, and internal fields get initialized to (0, 0, -1, -1). Perhaps, Microsoft realized, that Version should be value-type, who knows :).

But what is the best approach in handling unknown version values? Always check for null, or use default constructor?

  • 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-16T23:57:16+00:00Added an answer on May 16, 2026 at 11:57 pm

    I would use the “default” value of (0,0) rather than null. As you stated, you won’t have to deal with null checks (though, could easily be resolved using null coalescing), it’s a value used by the framework as the default value (and failure condition), and I don’t know of any situations where having version (0,0) makes sense anywhere. Also I was under the impression that assemblies must always have a version number. So a value of null might not always be available, particularly in an assembly. Or at least if this value is for your benefit, you should follow the pattern used by the framework.

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

Sidebar

Related Questions

Specifically this is regarding when using a client session cookie to identify a session
Is it possible to identify Does browser/client support gzip or not ? using http
In short, I'm doing 2-way SSL and the client certificate is used to identify
I need to identify a fraction from a form field in a recipe database
please help me to identify which of these following is more optimized code? for(int
I have a gitosis server at work, and I also use github for personal
in following code i can identify if client is connected and a row in
Consider searching a table that contains Apartment Rental Information: A client using the interface
I have a web-service which I secured using certificates. Now, I want to identify
We have photo client program written using im4j wrapper to invoke ImageMajick to process

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.