Answer Overflow Logo
Change Theme
Search Answer Overflow
GitHub
Add Your Server
Login
Home
Popular
Topics
Gaming
Programming
.0xdeadc0de
Posts
Comments
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
MS should do that :
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
although this is less readable than I anticipated
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
using
??
to short-circuit
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
I mean data can be null, so its nullable bool
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
Correct
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
Yes
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
Console.
Write
(_data
?
.
TryGetValue
(
"temperature"
,
out string
?
o
)
??
false
?
o
:
default)
Console.
Write
(_data
?
.
TryGetValue
(
"temperature"
,
out string
?
o
)
??
false
?
o
:
default)
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
Okay I see, how to yield null in this situation? Does csharp has such operator?
34 replies
C
C#
•
Created by .0xdeadc0de on 4/10/2023 in
#help
❔ ?[] operator for dictionaries
I am not testing against if dictionary is null
34 replies