Skip to content

Commit

Permalink
Removed ValueTuple dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ENikS committed Mar 2, 2019
1 parent b4113b6 commit d51f265
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/Dependency/Resolution/Overrides/DependencyOverride.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Unity.Resolution
/// given type, regardless of where it appears in the object graph.
/// </summary>
public class DependencyOverride : ResolverOverride,
IEquatable<(Type,string)>,
IEquatable<NamedType>,
IEquatable<FieldInfo>,
IEquatable<PropertyInfo>,
IEquatable<ParameterInfo>,
Expand Down Expand Up @@ -69,10 +69,10 @@ public override bool Equals(object obj)
return false;
}

public bool Equals((Type, string) other)
public bool Equals(NamedType other)
{
return (null == Type || other.Item1 == Type) &&
(null == Name || other.Item2 == Name);
return (null == Type || other.Type == Type) &&
(null == Name || other.Name == Name);
}

public bool Equals(FieldInfo other)
Expand Down
12 changes: 12 additions & 0 deletions src/Resolution/NamedType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace Unity.Resolution
{
public struct NamedType
{
public Type Type;
public string Name;

public override int GetHashCode() => ((Type?.GetHashCode() ?? 0) + 37) ^ ((Name?.GetHashCode() ?? 0) + 17);
}
}
5 changes: 0 additions & 5 deletions src/Unity.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
<DebugType>Full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.*" />
</ItemGroup>

<!-- Sourcelink -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -66,7 +62,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ValueTuple" Version="4.5.*" />
</ItemGroup>

</Project>

0 comments on commit d51f265

Please sign in to comment.