Skip to content

Consider In modifier when testing whether parameter is read-only #398

@zvirja

Description

@zvirja

Currently when testing a parameter for the immutability we consider the following attributes:

  • Parameter attribute flags
  • IsReadOnly attribute presence.

As it has been discussed here with @stakx we should additionally test for the required modifier presence to make the logic more robust. The parameter should be considered read-only if either:

  • parameter attributes has ParameterAttributes.In flag and In required modifier is present
  • parameter attributes has ParameterAttributes.In flag and IsReadOnly attribute is defined

We should tests the performance and add the quicker check first.

I'd suggest to postpone the improvement till the correct modifier type is clarified here: dotnet/csharplang#1655.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions