Skip to content

Commit

Permalink
Fixing bad rebase. dumb line endings...
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Apr 29, 2012
1 parent bfa2285 commit 904fff9
Showing 1 changed file with 37 additions and 87 deletions.
124 changes: 37 additions & 87 deletions src/AutoMapper/Internal/TypePair.cs
@@ -1,97 +1,47 @@
<<<<<<< HEAD
using System;

namespace AutoMapper.Internal
{
internal struct TypePair : IEquatable<TypePair>
{

public TypePair(Type sourceType, Type destinationType)
: this()
{
_sourceType = sourceType;
_destinationType = destinationType;
_hashcode = unchecked((_sourceType.GetHashCode()*397) ^ _destinationType.GetHashCode());
}

private readonly Type _destinationType;
private readonly int _hashcode;
private readonly Type _sourceType;

public Type SourceType
{
get { return _sourceType; }
}

public Type DestinationType
{
get { return _destinationType; }
}

public bool Equals(TypePair other)
{
return Equals(other._sourceType, _sourceType) && Equals(other._destinationType, _destinationType);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj.GetType() != typeof (TypePair)) return false;
return Equals((TypePair) obj);
}

public override int GetHashCode()
{
return _hashcode;
}
}
}
=======
using System;

namespace AutoMapper.Internal
{
internal struct TypePair : IEquatable<TypePair>
{
internal struct TypePair : IEquatable<TypePair>
{

public TypePair(Type sourceType, Type destinationType)
: this()
{
_sourceType = sourceType;
_destinationType = destinationType;
_hashcode = unchecked((_sourceType.GetHashCode()*397) ^ _destinationType.GetHashCode());
}
public TypePair(Type sourceType, Type destinationType)
: this()
{
_sourceType = sourceType;
_destinationType = destinationType;
_hashcode = unchecked((_sourceType.GetHashCode() * 397) ^ _destinationType.GetHashCode());
}

private readonly Type _destinationType;
private readonly int _hashcode;
private readonly Type _sourceType;

public Type SourceType
{
get { return _sourceType; }
}

public Type DestinationType
{
get { return _destinationType; }
}

public bool Equals(TypePair other)
{
return Equals(other._sourceType, _sourceType) && Equals(other._destinationType, _destinationType);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj.GetType() != typeof (TypePair)) return false;
return Equals((TypePair) obj);
}

public override int GetHashCode()
{
return _hashcode;
}
}
}
>>>>>>> 405eb8b... GetHashCode() returns a precalculated value in an unchecked context. Have put the calculation back into a checked context.
public Type SourceType
{
get { return _sourceType; }
}

public Type DestinationType
{
get { return _destinationType; }
}

public bool Equals(TypePair other)
{
return Equals(other._sourceType, _sourceType) && Equals(other._destinationType, _destinationType);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj.GetType() != typeof(TypePair)) return false;
return Equals((TypePair)obj);
}

public override int GetHashCode()
{
return _hashcode;
}
}
}

0 comments on commit 904fff9

Please sign in to comment.