Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FxCop - Use properties where appropriate

I have interface in service layer with several methods starting with Get and FxCop's Use properties where appropriate rule complains that I should consider using properties instead.

I tried to use SuppressMessageAttribute but when it's defined on interface it has no effect on member methods. Do I need to put SuppressMessageAttribute to every method or is there a way to suppress CA1024 for a whole type?

[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate"]
public interface IProjectService
{
    // Information and statistics about projects
    IList<ProjectInfo> GetProjects();
    ProjectsDashboard GetProjectsDashboard();

    // Project's settings
    ProjectSettings GetProjectSettings(Guid id);

    void SaveProjectSettings(ProjectSettings settings);
}
like image 802
Jozef Izso Avatar asked Feb 17 '09 15:02

Jozef Izso


1 Answers

You will have to add the attribute for each method.

like image 197
Sesh Avatar answered Oct 05 '22 00:10

Sesh