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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:40:35+00:00 2026-06-16T03:40:35+00:00

In Nullable micro-optimizations, part one , Eric mentions that Nullable<T> has a strange boxing

  • 0

In Nullable micro-optimizations, part one, Eric mentions that Nullable<T> has a strange boxing behaviour that could not be achieved by a similar user-defined type.

What are the special features that the C# language grants to the predefined Nullable<T> type? Especially the ones that could not be made to work on a MyNullable type.

Of course, Nullable<T> has special syntactic sugar T?, but my question is more about semantics.

  • 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-16T03:40:36+00:00Added an answer on June 16, 2026 at 3:40 am

    What I was getting at is: there is no such thing as a boxed nullable. When you box an int, you get a reference to a boxed int. When you box an int?, you get either a null reference or a reference to a boxed int. You never get a boxed int?.

    You can easily make your own Optional<T> struct, but you can’t implement a struct that has that boxing behaviour. Nullable<T>‘s special behaviour is baked into the runtime.

    This fact leads to a number of oddities. For example:

    • C# 4: Dynamic and Nullable<>

    • C# Reflection: How to get the type of a Nullable<int>?

    • Cannot change type to nullable in generic method

    And FYI there are other ways in which the Nullable<T> type is “magical”. For instance, though it is a struct type, it does not satisfy the struct constraint. There’s no way for you to make your own struct that has that property.

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

Sidebar

Related Questions

My objects often has nullable types properties that used as SQL commands parameters. I
My class has a nullable guid property which is not it's identifier . The
Nullable (C#) has a bit different meaning, but anyway both Option (Scala) and Nullable
My Sql Server database has some nullable nvarchar fields, and no nvarchar fields containing
I have a nullable column that should be only assignable once. Once set, any
I have a non-nullable database column which has a default value set. When inserting
I've got a nullable column in SQL Server 2008 that I use to store
I have a property that can be nullable or required depending on the status
I've got a nullable enum that, unlike others on the same page, doesn't work.
I'm working with a nullable DateTime object and ran into some strange behavior. Here's

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.