Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Commit

Permalink
evita InvalidCastException quando la lista non è di tipo string
Browse files Browse the repository at this point in the history
  • Loading branch information
Frediani authored and nicolaiarocci committed Mar 8, 2019
1 parent 1adb978 commit f967130
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions BaseClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public bool Equals(BaseClass other)
var v1 = prop.GetValue(this, null);
var v2 = prop.GetValue(other, null);

if (prop.PropertyType.IsGenericList()) {
if (prop.PropertyType.IsGenericList()
&& prop.PropertyType == typeof(List<string>)) {
// We only support List<string>.
if (!((List<string>) v1).SequenceEqual((List<string>) v2)) {
return false;
Expand Down Expand Up @@ -203,4 +204,4 @@ public static int GetHashCodeFromFields(this object obj, params object[] fields)
}
}
}
}
}

0 comments on commit f967130

Please sign in to comment.