Skip to content

Prefer language syntax over explicit calls to underlying implementations #138

@bkoelman

Description

@bkoelman

How about this for a new rule?
AV1526 or AV2201: Prefer language syntax over explicit calls to underlying implementations


Prefer:

	(string, int) tuple = ("", 1);

rather than:

	ValueTuple<string, int> tuple = new ValueTuple<string, int>("", 1);

Prefer:

	DateTime? startDate;

rather than:

	Nullable<DateTime> startDate;

Prefer:

	if (startDate != null) ...

rather than:

	if (startDate.HasValue) ...

Prefer:

	if (startDate > DateTime.Now) ...

rather than:

	if (startDate.HasValue && startDate.Value > DateTime.Now) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions