Skip to content

[Warn] - Prefer nameof(...) over strings #10

@Liamth99

Description

@Liamth99

Example of code diagnostic:

// Good example
[ForMember<User, UserDto>(nameof(UserDto.TimeOfBirth))]
public static TimeOnly GetTimeOfBirth(User source) => new (source.DateOfBirth.UtcDateTime.TimeOfDay.Ticks);

// Bad example
[ForMember<User, UserDto>("TimeOfBirth")]
public static TimeOnly GetTimeOfBirth(User source) => new (source.DateOfBirth.UtcDateTime.TimeOfDay.Ticks);

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions