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; |
|
} |
|
} |
Many properties in Person and its subclasses use nearly identical validation logic inside setters. This results in repeated code that should be centralized.
TaskRefactoring/ClassLibrary1.cs
Lines 33 to 46 in 672599a
TaskRefactoring/ClassLibrary1.cs
Lines 47 to 60 in 672599a
TaskRefactoring/ClassLibrary1.cs
Lines 61 to 74 in 672599a