Skip to content
Discussion options

You must be logged in to vote

@PaulRitter the problem is that not the JITTer implements nullability - it is done by the IL Compiler.

For example: T? ReturnVal<T>() where T : struct => null;
is compiled to:

static Nullable<T> ReturnVal<T>() where T : struct
{
        return null;
}

while T? ReturnVal<T>() where T : class => null;
is compiled to:

static T ReturnVal<T>() where T : class
{
        return null;
}

Replies: 2 comments 35 replies

Comment options

You must be logged in to vote
2 replies
@PaulRitter
Comment options

@Joe4evr
Comment options

Answer selected by PaulRitter
Comment options

You must be logged in to vote
33 replies
@HaloFour
Comment options

@TahirAhmadov
Comment options

@CyrusNajmabadi
Comment options

@sab39
Comment options

@CyrusNajmabadi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants