Skip to content

Make type parameter T of the Null() method nullable and add overload for value types.#261

Merged
ardalis merged 13 commits intoardalis:mainfrom
amal-stack:main
Jul 31, 2023
Merged

Make type parameter T of the Null() method nullable and add overload for value types.#261
ardalis merged 13 commits intoardalis:mainfrom
amal-stack:main

Conversation

@amal-stack
Copy link
Contributor

@amal-stack amal-stack commented Feb 23, 2023

  • Solves Make T nullable #260 which suppresses nullable warnings.
  • Adds an additional overload of Null() with a value type constraint on T (where T : struct) to allow assignment to non-nullable value types when passed nullable value types (Enhanced support for value types #242) . For example, the following is now allowed with this overload:
int? nullableInt = 42;
int nonNullableInt = Guard.Against.Null(nullableInt, nameof(nullableInt));
  • Also added unit tests to ensure that the type of the return value is non-nullable.

@mwasson74
Copy link

Hey @amal-stack, me again from #258. I see you've submitted this PR. Do you know when this might be released? I see it's still "open" and says something about "Expected - Waiting for status to be reported" but I have no idea what that means 😬

@mwasson74
Copy link

Hey @amal-stack, me again. Sorry to keep bothering you, but it seems this got "stuck" again. Any idea when this will be merged and released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants