From 6c1fe6ea3e4e3915fc4164c43230210f9a0ac24f Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Tue, 23 Jun 2015 11:54:19 +0100 Subject: Implement Clone. Fixes issue #527. --- csharp/src/ProtocolBuffers/IMessage.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'csharp/src/ProtocolBuffers/IMessage.cs') diff --git a/csharp/src/ProtocolBuffers/IMessage.cs b/csharp/src/ProtocolBuffers/IMessage.cs index 9c2a2d85..32dfcaff 100644 --- a/csharp/src/ProtocolBuffers/IMessage.cs +++ b/csharp/src/ProtocolBuffers/IMessage.cs @@ -93,4 +93,22 @@ namespace Google.Protobuf /// The message to merge with this one. Must not be null. void MergeFrom(T message); } + + /// + /// Generic interface for a deeply cloneable type. + /// + /// + /// In practice, all generated messages implement this interface. + /// However, due to the type constraint on T in , + /// it is simpler to keep this as a separate interface. + /// + /// The type itself, returned by the method. + public interface IDeepCloneable + { + /// + /// Creates a deep clone of this object. + /// + /// A deep clone of this object. + T Clone(); + } } \ No newline at end of file -- cgit v1.2.3