Skip to content

Commit 7d1a248

Browse files
committed
Add ICloneable for record
1 parent 13b7943 commit 7d1a248

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

AdvancedSharpAdbClient/DeviceCommands/DeviceClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace AdvancedSharpAdbClient.DeviceCommands
1919
/// <param name="AdbClient">The <see cref="IAdbClient"/> to use to communicate with the Android Debug Bridge.</param>
2020
/// <param name="Device">The device on which to process command.</param>
2121
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
22-
public partial record class DeviceClient(IAdbClient AdbClient, DeviceData Device)
22+
public partial record class DeviceClient(IAdbClient AdbClient, DeviceData Device) : ICloneable<DeviceClient>, ICloneable
2323
{
2424
/// <summary>
2525
/// The <see cref="IAdbClient"/> to use when communicating with the device.
@@ -443,6 +443,12 @@ public void Deconstruct(out IAdbClient client, out DeviceData device)
443443
device = Device;
444444
}
445445

446+
/// <inheritdoc/>
447+
DeviceClient ICloneable<DeviceClient>.Clone() => this with { };
448+
449+
/// <inheritdoc/>
450+
object ICloneable.Clone() => ((ICloneable<DeviceClient>)this).Clone();
451+
446452
#if !NET40_OR_GREATER && !NETCOREAPP2_0_OR_GREATER && !NETSTANDARD2_0_OR_GREATER && !UAP10_0_15138_0
447453
/// <inheritdoc/>
448454
public override int GetHashCode() => HashCode.Combine(EqualityContract, AdbClient, Device);

0 commit comments

Comments
 (0)