Skip to content

Code Duplication in Property Getters/Setters #10

@DanielBr840

Description

@DanielBr840

Many properties in Person and its subclasses use nearly identical validation logic inside setters. This results in repeated code that should be centralized.

public string Name
{
set
{
if (value != null || value.Length > 2)
{
name = value;
}
}
get
{
return name;
}
}

public string Surname
{
set
{
if (value != null || value.Length > 2)
{
surname = value;
}
}
get
{
return surname;
}
}

public int BirthDay
{
set
{
if (value != 0)
{
birthDay = value;
}
}
get
{
return birthDay;
}
}

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