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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:56:31+00:00 2026-05-28T04:56:31+00:00

Here is the condition I used to detect if we are dealing with a

  • 0

Here is the condition I used to detect if we are dealing with a Nullable Type :

System.Nullable.GetUnderlyingType(itemType) != null

and here the code of my teammate :

itemType.IsGenericType && itemType.GetGenericTypeDefinition() == typeof(Nullable<>)

We actually didnt find a case where one will return true and the other false (or vice-versa) but are these 2 snippets strictly equivalent ?

  • 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-28T04:56:32+00:00Added an answer on May 28, 2026 at 4:56 am

    From MSDN for Nullable.GetUnderlyingType Method:

    The type argument of the nullableType parameter, if the nullableType parameter is a closed generic nullable type; otherwise, null.

    So, yes it is safe to use the former version.

    Decompiled from GetUnderlyingType:

    public static Type GetUnderlyingType(Type nullableType)
    {
      if (nullableType == null)
        throw new ArgumentNullException("nullableType");
      Type type = (Type) null;
      if (nullableType.IsGenericType && !nullableType.IsGenericTypeDefinition && nullableType.GetGenericTypeDefinition() == typeof (Nullable<>))
        type = nullableType.GetGenericArguments()[0];
      return type;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if (condition) { #lol. Some code here } else { header(Location:/);//i'm trying to redirect
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is my Web.config file <membership> <providers> <clear /> <add name=AspNetSqlMembershipProvider type=System.Web.Security.SqlMembershipProvider connectionStringName=ApplicationServices maxInvalidPasswordAttempts=5
here I am trying to call overloaded constructor after some condition has met in
Are there any race condition issues when using NSNotifications within a single thread? Here
I need to be able to strip out a condition in a string, here
I want to display error message or alert message after checking the condition. here
I want a text color to be red in color on certain condition. Here
Title may be confusing, but here's explanation with code. Based on some conditions, I
I want to use conditional css in my datatable. Here is my code. <ui:repeat

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.