Skip to content

Commit f54ec00

Browse files
committed
Cleanup.
1 parent 847ec30 commit f54ec00

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

src/CsvHelper/ObjectCreator.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,32 +183,35 @@ private enum MatchType
183183
Fuzzy = 2
184184
}
185185

186-
internal struct CacheKey : IEquatable<CacheKey>
186+
private struct CacheKey : IEquatable<CacheKey>
187187
{
188-
private readonly Type _type;
189-
private readonly Type[] _args;
188+
private readonly Type type;
189+
private readonly Type[] args;
190190

191191
public CacheKey(Type type, Type[] args)
192192
{
193-
_type = type;
194-
_args = args;
193+
this.type = type;
194+
this.args = args;
195195
}
196196

197197
public override int GetHashCode()
198198
{
199199
var hashCode = new HashCode();
200-
hashCode.Add(_type.GetHashCode());
201-
for (var i = 0; i < _args.Length; i++)
200+
hashCode.Add(type.GetHashCode());
201+
for (var i = 0; i < args.Length; i++)
202202
{
203-
hashCode.Add(_args[i].GetHashCode());
203+
hashCode.Add(args[i].GetHashCode());
204204
}
205205

206206
return hashCode.ToHashCode();
207207
}
208208

209209
public override bool Equals(object? obj)
210210
{
211-
if (obj == null) return false;
211+
if (obj == null)
212+
{
213+
return false;
214+
}
212215

213216
if (obj is CacheKey key)
214217
{
@@ -220,12 +223,21 @@ public override bool Equals(object? obj)
220223

221224
public bool Equals(CacheKey other)
222225
{
223-
if (other._type != _type) return false;
224-
if (other._args.Length != _args.Length) return false;
225-
for (var i = 0; i < _args.Length; i++)
226+
if (other.type != type)
227+
{
228+
return false;
229+
}
230+
231+
if (other.args.Length != args.Length)
226232
{
227-
if (other._args[i] != _args[i]) return false;
233+
return false;
228234
}
235+
236+
for (var i = 0; i < args.Length; i++)
237+
{
238+
if (other.args[i] != args[i]) return false;
239+
}
240+
229241
return true;
230242
}
231243
}

0 commit comments

Comments
 (0)