Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about nullability

Read more about nullability

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - nullability

Difficulty defining nullability constraints

I have an extension function called TryGetValueAs which basically combines TryGetValue with a cast. The problem is that I keep getting nullability warnings and I can't seem to get it right. I have the...
test-img

Rick de Water

c#

.net-6.0

nullability

Votes: 0

Answers: 2

Latest Answer

Here is my attempt: public static bool TryGetValueAs<TOut, TKey, TValue>( this IDictionary<TKey, TValue> dictionary, TKey key, [NotNullWhen(true)] out TOut? value) where ...
test-img

tymtam

How to Determine Nullability (NRT) of Generic Type Parameter?

For example, I might have a method with the following signature: public async Task<ViewModel?> GetPersonUri() Using reflection I would like to determine if the type parameter of Task is a nulla...
test-img

Dejan

c#

reflection

system.reflection

c#-10.0

nullability

Votes: 0

Answers: 1

Latest Answer

In .NET 6 onwards, we gained the NullabilityInfoContext type, see this answer for details. Prior to this, you have to manually inspect the attributes yourself. This seems to do the trick: public stat...
test-img

canton7

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved