Skip to content

GCop628 false alarm #300

Description

@sungam3r
public Task DoSome(int? value) // GCop628: Maybe define this method on 'Nullable' class as it's using 1 of its members (compared to 0 from this type)
{
    if (value.HasValue)
      return Task.CompletedTask;
    return null;
}

Obviously, we cannot move the method inside System.Nullable<T>. The rule should take into account the system types. Also note if you make the method static, then there is no warning.

Activity

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

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