Skip to content

null-conditional for boolean operation should be typed to nullable  #624

Open
@jrmoreno1

Description

@jrmoreno1

The Null Conditional operator when used in conjunction with a boolean function should result in a nullable value and not require parentheses around it before checking GetValueOrDefault or HasValue

Dim ids As List(Of Integer) = Nothing
If Not ids?.Any() Then 
End If

vs

Dim ids As List(Of Integer) = Nothing
If Not (ids?.Any()).GetValueOrDefault  Then 
End If

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions