aboutsummaryrefslogtreecommitdiff
path: root/csharp/ProtocolBuffers/GeneratedExtension.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/ProtocolBuffers/GeneratedExtension.cs')
-rw-r--r--csharp/ProtocolBuffers/GeneratedExtension.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/csharp/ProtocolBuffers/GeneratedExtension.cs b/csharp/ProtocolBuffers/GeneratedExtension.cs
new file mode 100644
index 00000000..52d3349b
--- /dev/null
+++ b/csharp/ProtocolBuffers/GeneratedExtension.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Google.ProtocolBuffers.Descriptors;
+
+namespace Google.ProtocolBuffers {
+
+ /// <summary>
+ /// Base class for all generated extensions.
+ /// </summary>
+ /// <remarks>
+ /// The protocol compiler generates a static singleton instance of this
+ /// class for each extension. For exmaple, imagine a .proto file with:
+ /// <code>
+ /// message Foo {
+ /// extensions 1000 to max
+ /// }
+ ///
+ /// extend Foo {
+ /// optional int32 bar;
+ /// }
+ /// </code>
+ /// Then MyProto.Foo.Bar has type GeneratedExtension&lt;MyProto.Foo,int&gt;.
+ /// <para />
+ /// In general, users should ignore the details of this type, and
+ /// simply use the static singletons as parmaeters to the extension accessors
+ /// in ExtendableMessage and ExtendableBuilder.
+ /// </remarks>
+ public class GeneratedExtension<TContainer, TExtension> where TContainer : IMessage<TContainer> {
+ public FieldDescriptor Descriptor;
+
+ public IMessage MessageDefaultInstance;
+ }
+}