Several performance tweaks
- Removed default value assingment when default is equal to default(T)
- Added Benchmarks for most types and repeated/packed arrays
- Left PopsicleList's list fields uninitialized util needed
- Changed CodedInputStream's repated/packed reader
- Changed Enum writers to simply cast to int
- Changed the WriteEnum to use object rawValue that provides .ToString() if needed
- Should be fully on par with original library for performance, gaining 2x-3x in some cases
diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs
index 58cba4a..dcaad48 100644
--- a/src/AddressBook/AddressBookProtos.cs
+++ b/src/AddressBook/AddressBookProtos.cs
@@ -163,7 +163,7 @@
             output.WriteString(1, field_names[0], Number);

           }

           if (hasType) {

-            output.WriteEnum(2, field_names[1], (int) Type, Type.ToString());

+            output.WriteEnum(2, field_names[1], (int) Type, Type);

           }

           UnknownFields.WriteTo(output);

         }

@@ -407,7 +407,7 @@
     

     public const int IdFieldNumber = 2;

     private bool hasId;

-    private int id_ = 0;

+    private int id_;

     public bool HasId {

       get { return hasId; }

     }

diff --git a/src/ProtoBench/Program.cs b/src/ProtoBench/Program.cs
index 2be2bf4..e5d98df 100644
--- a/src/ProtoBench/Program.cs
+++ b/src/ProtoBench/Program.cs
@@ -39,6 +39,7 @@
 using System.Diagnostics;

 using System.IO;

 using System.Threading;

+using Google.ProtocolBuffers.TestProtos;

 

 namespace Google.ProtocolBuffers.ProtoBench

 {

@@ -49,8 +50,7 @@
     {

         private static TimeSpan MinSampleTime = TimeSpan.FromSeconds(2);

         private static TimeSpan TargetTime = TimeSpan.FromSeconds(30);

-        private static bool FastTest = false;

-        private static bool Verbose = false;

+        private static bool Verbose = false, FastTest = false;

         // Avoid a .NET 3.5 dependency

         private delegate void Action();

 

@@ -63,21 +63,27 @@
         {

             List<string> temp = new List<string>(args);

 

-            FastTest = temp.Remove("/fast") || temp.Remove("-fast");

             Verbose = temp.Remove("/verbose") || temp.Remove("-verbose");

 

+            if (true == (FastTest = (temp.Remove("/fast") || temp.Remove("-fast"))))

+                TargetTime = TimeSpan.FromSeconds(10);

+

             RunBenchmark = BenchmarkV1;

             if (temp.Remove("/v2") || temp.Remove("-v2"))

             {

-                string cpu = temp.Find(x => x.StartsWith("-cpu:"));

-                int cpuIx = 1;

-                if (cpu != null) cpuIx = 1 << Math.Max(0, int.Parse(cpu.Substring(5)));

-

-                //pin the entire process to a single CPU

-                Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(cpuIx);

                 Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;

                 RunBenchmark = BenchmarkV2;

             }

+            if (temp.Remove("/all") || temp.Remove("-all"))

+            {

+                if(FastTest)

+                    TargetTime = TimeSpan.FromSeconds(5);

+                foreach (KeyValuePair<string, string> item in MakeTests())

+                {

+                    temp.Add(item.Key);

+                    temp.Add(item.Value);

+                }

+            }

             args = temp.ToArray();

 

             if (args.Length < 2 || (args.Length%2) != 0)

@@ -92,16 +98,16 @@
             bool success = true;

             for (int i = 0; i < args.Length; i += 2)

             {

-                success &= RunTest(args[i], args[i + 1]);

+                success &= RunTest(args[i], args[i + 1], null);

             }

             return success ? 0 : 1;

         }

-        

+

         /// <summary>

         /// Runs a single test. Error messages are displayed to Console.Error, and the return value indicates

         /// general success/failure.

         /// </summary>

-        public static bool RunTest(string typeName, string file)

+        public static bool RunTest(string typeName, string file, byte[] inputData)

         {

             Console.WriteLine("Benchmarking {0} with file {1}", typeName, file);

             IMessage defaultMessage;

@@ -116,30 +122,32 @@
             }

             try

             {

-                byte[] inputData = File.ReadAllBytes(file);

+                ExtensionRegistry registry = ExtensionRegistry.Empty;

+                inputData = inputData ?? File.ReadAllBytes(file);

                 MemoryStream inputStream = new MemoryStream(inputData);

                 ByteString inputString = ByteString.CopyFrom(inputData);

                 IMessage sampleMessage =

-                    defaultMessage.WeakCreateBuilderForType().WeakMergeFrom(inputString).WeakBuild();

+                    defaultMessage.WeakCreateBuilderForType().WeakMergeFrom(inputString, registry).WeakBuild();

                 if(!FastTest) RunBenchmark("Serialize to byte string", inputData.Length, () => sampleMessage.ToByteString());

                 RunBenchmark("Serialize to byte array", inputData.Length, () => sampleMessage.ToByteArray());

                 if (!FastTest) RunBenchmark("Serialize to memory stream", inputData.Length,

                           () => sampleMessage.WriteTo(new MemoryStream()));

                 if (!FastTest) RunBenchmark("Deserialize from byte string", inputData.Length,

                           () => defaultMessage.WeakCreateBuilderForType()

-                                    .WeakMergeFrom(inputString)

+                                    .WeakMergeFrom(inputString, registry)

                                     .WeakBuild()

                     );

+

                 RunBenchmark("Deserialize from byte array", inputData.Length,

                           () => defaultMessage.WeakCreateBuilderForType()

-                                    .WeakMergeFrom(CodedInputStream.CreateInstance(inputData))

+                                    .WeakMergeFrom(CodedInputStream.CreateInstance(inputData), registry)

                                     .WeakBuild()

                     );

                 if (!FastTest) RunBenchmark("Deserialize from memory stream", inputData.Length, 

                     () => {

                       inputStream.Position = 0;

                       defaultMessage.WeakCreateBuilderForType().WeakMergeFrom(

-                              CodedInputStream.CreateInstance(inputStream))

+                              CodedInputStream.CreateInstance(inputStream), registry)

                           .WeakBuild();

                   });

                 Console.WriteLine();

@@ -156,6 +164,7 @@
 

         private static void BenchmarkV2(string name, long dataSize, Action action)

         {

+            Thread.BeginThreadAffinity();

             TimeSpan elapsed = TimeSpan.Zero;

             long runs = 0;

             long totalCount = 0;

@@ -184,7 +193,7 @@
             double first = (iterations * dataSize) / (elapsed.TotalSeconds * 1024 * 1024);

             if (Verbose) Console.WriteLine("Round ---: Count = {1,6}, Bps = {2,8:f3}", 0, iterations, first);

             elapsed = TimeSpan.Zero;

-            int max = FastTest ? 10 : 30;

+            int max = (int)TargetTime.TotalSeconds;

 

             while (runs < max)

             {

@@ -192,7 +201,8 @@
                 // Accumulate and scale for next cycle.

                 

                 double bps = (iterations * dataSize) / (cycle.TotalSeconds * 1024 * 1024);

-                if (Verbose) Console.WriteLine("Round {0,3}: Count = {1,6}, Bps = {2,8:f3}", runs, iterations, bps);

+                if (Verbose) Console.WriteLine("Round {1,3}: Count = {2,6}, Bps = {3,8:f3}",

+                    0, runs, iterations, bps);

 

                 best = Math.Max(best, bps);

                 worst = Math.Min(worst, bps);

@@ -203,8 +213,9 @@
                 iterations = (int) ((target.Ticks*totalCount)/(double) elapsed.Ticks);

             }

 

-            Console.WriteLine("{0}: averages {1} per {2:f3}s for {3} runs; avg: {4:f3}mbps; best: {5:f3}mbps; worst: {6:f3}mbps",

-                              name, totalCount / runs, elapsed.TotalSeconds / runs, runs,

+            Thread.EndThreadAffinity();

+            Console.WriteLine("{1}: averages {2} per {3:f3}s for {4} runs; avg: {5:f3}mbps; best: {6:f3}mbps; worst: {7:f3}mbps",

+                              0, name, totalCount / runs, elapsed.TotalSeconds / runs, runs,

                               (totalCount * dataSize) / (elapsed.TotalSeconds * 1024 * 1024), best, worst);

         }

 

@@ -244,5 +255,119 @@
             sw.Stop();

             return sw.Elapsed;

         }

+

+        private static IEnumerable<KeyValuePair<string, string>> MakeTests()

+        {

+            //Aggregate Tests

+            yield return MakeWorkItem("all-types", MakeTestAllTypes());

+            yield return MakeWorkItem("repeated-100", MakeRepeatedTestAllTypes(100));

+            yield return MakeWorkItem("packed-100", MakeTestPackedTypes(100));

+

+            //Discrete Tests

+            foreach (KeyValuePair<string, Action<TestAllTypes.Builder>> item in MakeTestAllTypes())

+                yield return MakeWorkItem(item.Key, new[] { item });

+

+            foreach (KeyValuePair<string, Action<TestAllTypes.Builder>> item in MakeRepeatedTestAllTypes(100))

+                yield return MakeWorkItem(item.Key, new[] { item });

+

+            foreach (KeyValuePair<string, Action<TestPackedTypes.Builder>> item in MakeTestPackedTypes(100))

+                yield return MakeWorkItem(item.Key, new[] { item });

+        }

+

+        private static IEnumerable<KeyValuePair<string, Action<TestAllTypes.Builder>>> MakeTestAllTypes()

+        {

+            // Many of the raw type serializers below perform poorly due to the numerous fields defined

+            // in TestAllTypes.

+

+            //single values

+            yield return MakeItem<TestAllTypes.Builder>("int32", 1, x => x.SetOptionalInt32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("int64", 1, x => x.SetOptionalInt64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("uint32", 1, x => x.SetOptionalUint32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("uint64", 1, x => x.SetOptionalUint64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("sint32", 1, x => x.SetOptionalSint32(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("sint64", 1, x => x.SetOptionalSint64(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("fixed32", 1, x => x.SetOptionalFixed32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("fixed64", 1, x => x.SetOptionalFixed64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("sfixed32", 1, x => x.SetOptionalSfixed32(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("sfixed64", 1, x => x.SetOptionalSfixed64(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("float", 1, x => x.SetOptionalFloat(1001.1001f));

+            yield return MakeItem<TestAllTypes.Builder>("double", 1, x => x.SetOptionalDouble(1001.1001));

+            yield return MakeItem<TestAllTypes.Builder>("bool", 1, x => x.SetOptionalBool(true));

+            yield return MakeItem<TestAllTypes.Builder>("string", 1, x => x.SetOptionalString("this is a string value"));

+            yield return MakeItem<TestAllTypes.Builder>("bytes", 1, x => x.SetOptionalBytes(ByteString.CopyFromUtf8("this is an array of bytes")));

+            yield return MakeItem<TestAllTypes.Builder>("group", 1, x => x.SetOptionalGroup(new TestAllTypes.Types.OptionalGroup.Builder().SetA(1001)));

+            yield return MakeItem<TestAllTypes.Builder>("message", 1, x => x.SetOptionalNestedMessage(new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001)));

+            yield return MakeItem<TestAllTypes.Builder>("enum", 1, x => x.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO));

+        }

+

+        private static IEnumerable<KeyValuePair<string, Action<TestAllTypes.Builder>>> MakeRepeatedTestAllTypes(int size)

+        {

+            //repeated values

+            yield return MakeItem<TestAllTypes.Builder>("repeated-int32", size, x => x.AddRepeatedInt32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-int64", size, x => x.AddRepeatedInt64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-uint32", size, x => x.AddRepeatedUint32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-uint64", size, x => x.AddRepeatedUint64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-sint32", size, x => x.AddRepeatedSint32(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-sint64", size, x => x.AddRepeatedSint64(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-fixed32", size, x => x.AddRepeatedFixed32(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-fixed64", size, x => x.AddRepeatedFixed64(1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-sfixed32", size, x => x.AddRepeatedSfixed32(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-sfixed64", size, x => x.AddRepeatedSfixed64(-1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-float", size, x => x.AddRepeatedFloat(1001.1001f));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-double", size, x => x.AddRepeatedDouble(1001.1001));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-bool", size, x => x.AddRepeatedBool(true));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-string", size, x => x.AddRepeatedString("this is a string value"));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-bytes", size, x => x.AddRepeatedBytes(ByteString.CopyFromUtf8("this is an array of bytes")));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-group", size, x => x.AddRepeatedGroup(new TestAllTypes.Types.RepeatedGroup.Builder().SetA(1001)));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-message", size, x => x.AddRepeatedNestedMessage(new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001)));

+            yield return MakeItem<TestAllTypes.Builder>("repeated-enum", size, x => x.AddRepeatedNestedEnum(TestAllTypes.Types.NestedEnum.FOO));

+        }

+

+        private static IEnumerable<KeyValuePair<string, Action<TestPackedTypes.Builder>>> MakeTestPackedTypes(int size)

+        {

+            //packed values

+            yield return MakeItem<TestPackedTypes.Builder>("packed-int32", size, x => x.AddPackedInt32(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-int64", size, x => x.AddPackedInt64(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-uint32", size, x => x.AddPackedUint32(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-uint64", size, x => x.AddPackedUint64(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-sint32", size, x => x.AddPackedSint32(-1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-sint64", size, x => x.AddPackedSint64(-1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-fixed32", size, x => x.AddPackedFixed32(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-fixed64", size, x => x.AddPackedFixed64(1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-sfixed32", size, x => x.AddPackedSfixed32(-1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-sfixed64", size, x => x.AddPackedSfixed64(-1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-float", size, x => x.AddPackedFloat(1001.1001f));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-double", size, x => x.AddPackedDouble(1001.1001));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-bool", size, x => x.AddPackedBool(true));

+            yield return MakeItem<TestPackedTypes.Builder>("packed-enum", size, x => x.AddPackedEnum(ForeignEnum.FOREIGN_FOO));

+        }

+

+        private static KeyValuePair<string, Action<T>> MakeItem<T>(string name, int repeated, Action<T> build) where T : IBuilderLite, new()

+        {

+            if (repeated == 1)

+                return new KeyValuePair<string, Action<T>>(name, build);

+

+            return new KeyValuePair<string, Action<T>>(

+                String.Format("{0}[{1}]", name, repeated),

+                x =>

+                {

+                    for (int i = 0; i < repeated; i++)

+                        build(x);

+                }

+            );

+        }

+

+        private static KeyValuePair<string, string> MakeWorkItem<T>(string name, IEnumerable<KeyValuePair<string, Action<T>>> builders) where T : IBuilderLite, new()

+        {

+            T builder = new T();

+

+            foreach (KeyValuePair<string, Action<T>> item in builders)

+                item.Value(builder);

+

+            IMessageLite msg = builder.WeakBuild();

+            string fname = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "unittest_" + name + ".dat");

+            File.WriteAllBytes(fname, msg.ToByteArray());

+            return new KeyValuePair<string, string>(String.Format("{0},{1}", msg.GetType().FullName, msg.GetType().Assembly.GetName().Name), fname);

+        }

     }

 }
\ No newline at end of file
diff --git a/src/ProtoBench/ProtoBench.csproj b/src/ProtoBench/ProtoBench.csproj
index f55764e..74e3ef5 100644
--- a/src/ProtoBench/ProtoBench.csproj
+++ b/src/ProtoBench/ProtoBench.csproj
@@ -59,6 +59,12 @@
     <Reference Include="System.Xml" />

   </ItemGroup>

   <ItemGroup>

+    <Compile Include="..\ProtocolBuffers.Test\TestProtos\UnitTestImportProtoFile.cs">

+      <Link>UnitTestImportProtoFile.cs</Link>

+    </Compile>

+    <Compile Include="..\ProtocolBuffers.Test\TestProtos\UnitTestProtoFile.cs">

+      <Link>UnitTestProtoFile.cs</Link>

+    </Compile>

     <Compile Include="Program.cs" />

     <Compile Include="Properties\AssemblyInfo.cs" />

   </ItemGroup>

diff --git a/src/ProtoGen/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs
index d5e8c63..1dc2db2 100644
--- a/src/ProtoGen/EnumFieldGenerator.cs
+++ b/src/ProtoGen/EnumFieldGenerator.cs
@@ -112,7 +112,7 @@
         public void GenerateSerializationCode(TextGenerator writer)

         {

             writer.WriteLine("if (has{0}) {{", PropertyName);

-            writer.WriteLine("  output.WriteEnum({0}, field_names[{2}], (int) {1}, {1}.ToString());", Number, PropertyName, FieldOrdinal);

+            writer.WriteLine("  output.WriteEnum({0}, field_names[{2}], (int) {1}, {1});", Number, PropertyName, FieldOrdinal);

             writer.WriteLine("}");

         }

 

diff --git a/src/ProtoGen/FieldGeneratorBase.cs b/src/ProtoGen/FieldGeneratorBase.cs
index 77a8765..4af013d 100644
--- a/src/ProtoGen/FieldGeneratorBase.cs
+++ b/src/ProtoGen/FieldGeneratorBase.cs
@@ -68,6 +68,36 @@
             return true;

         }

 

+        protected bool HasDefaultValue

+        {

+            get 

+            {

+                switch (Descriptor.FieldType)

+                {

+                    case FieldType.Float:

+                    case FieldType.Double:

+                    case FieldType.Int32:

+                    case FieldType.Int64:

+                    case FieldType.SInt32:

+                    case FieldType.SInt64:

+                    case FieldType.SFixed32:

+                    case FieldType.SFixed64:

+                    case FieldType.UInt32:

+                    case FieldType.UInt64:

+                    case FieldType.Fixed32:

+                    case FieldType.Fixed64:

+                        {

+                            IConvertible value = (IConvertible) Descriptor.DefaultValue;

+                            return value.ToString(CultureInfo.InvariantCulture) != "0";

+                        }

+                    case FieldType.Bool:

+                        return ((bool) Descriptor.DefaultValue) == true;

+                    default:

+                        return true;

+                }

+            }

+        }

+

         /// <remarks>Copy exists in ExtensionGenerator.cs</remarks>

         protected string DefaultValue

         {

diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs
index 6296cdc..0002c2a 100644
--- a/src/ProtoGen/PrimitiveFieldGenerator.cs
+++ b/src/ProtoGen/PrimitiveFieldGenerator.cs
@@ -49,7 +49,7 @@
         public void GenerateMembers(TextGenerator writer)

         {

             writer.WriteLine("private bool has{0};", PropertyName);

-            writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue);

+            writer.WriteLine("private {0} {1}_{2};", TypeName, Name, HasDefaultValue ? " = " + DefaultValue : "");

             writer.WriteLine("public bool Has{0} {{", PropertyName);

             writer.WriteLine("  get {{ return has{0}; }}", PropertyName);

             writer.WriteLine("}");

diff --git a/src/ProtocolBuffers.Test/AbstractMessageTest.cs b/src/ProtocolBuffers.Test/AbstractMessageTest.cs
index 95bfcf5..bef5052 100644
--- a/src/ProtocolBuffers.Test/AbstractMessageTest.cs
+++ b/src/ProtocolBuffers.Test/AbstractMessageTest.cs
@@ -63,6 +63,13 @@
         }

 

         [Test]

+        public void CreateAndBuild()

+        {

+            TestAllTypes.CreateBuilder()

+                .Build();

+        }

+

+        [Test]

         public void SerializedSize()

         {

             TestAllTypes message = TestUtil.GetAllSet();

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
index e43026a..6131d9c 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
@@ -2475,7 +2475,7 @@
     

     public const int FooFieldNumber = 1;

     private bool hasFoo;

-    private int foo_ = 0;

+    private int foo_;

     public bool HasFoo {

       get { return hasFoo; }

     }

@@ -2485,7 +2485,7 @@
     

     public const int Foo2FieldNumber = 2;

     private bool hasFoo2;

-    private int foo2_ = 0;

+    private int foo2_;

     public bool HasFoo2 {

       get { return hasFoo2; }

     }

@@ -2495,7 +2495,7 @@
     

     public const int Foo3FieldNumber = 3;

     private bool hasFoo3;

-    private int foo3_ = 0;

+    private int foo3_;

     public bool HasFoo3 {

       get { return hasFoo3; }

     }

@@ -2835,7 +2835,7 @@
         public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4> ComplexOpt4;

         public const int WaldoFieldNumber = 1;

         private bool hasWaldo;

-        private int waldo_ = 0;

+        private int waldo_;

         public bool HasWaldo {

           get { return hasWaldo; }

         }

@@ -3060,7 +3060,7 @@
     

     public const int BazFieldNumber = 2;

     private bool hasBaz;

-    private int baz_ = 0;

+    private int baz_;

     public bool HasBaz {

       get { return hasBaz; }

     }

@@ -3457,7 +3457,7 @@
         

         public const int PlughFieldNumber = 3;

         private bool hasPlugh;

-        private int plugh_ = 0;

+        private int plugh_;

         public bool HasPlugh {

           get { return hasPlugh; }

         }

@@ -3672,7 +3672,7 @@
     

     public const int QuxFieldNumber = 1;

     private bool hasQux;

-    private int qux_ = 0;

+    private int qux_;

     public bool HasQux {

       get { return hasQux; }

     }

@@ -3975,7 +3975,7 @@
     

     public const int XyzzyFieldNumber = 7593951;

     private bool hasXyzzy;

-    private int xyzzy_ = 0;

+    private int xyzzy_;

     public bool HasXyzzy {

       get { return hasXyzzy; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs
index 00485d6..24e4c3f 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs
@@ -188,7 +188,7 @@
     

     public const int Field80FieldNumber = 80;

     private bool hasField80;

-    private bool field80_ = false;

+    private bool field80_;

     public bool HasField80 {

       get { return hasField80; }

     }

@@ -208,7 +208,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private int field2_ = 0;

+    private int field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -218,7 +218,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private int field3_ = 0;

+    private int field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -228,7 +228,7 @@
     

     public const int Field280FieldNumber = 280;

     private bool hasField280;

-    private int field280_ = 0;

+    private int field280_;

     public bool HasField280 {

       get { return hasField280; }

     }

@@ -238,7 +238,7 @@
     

     public const int Field6FieldNumber = 6;

     private bool hasField6;

-    private int field6_ = 0;

+    private int field6_;

     public bool HasField6 {

       get { return hasField6; }

     }

@@ -248,7 +248,7 @@
     

     public const int Field22FieldNumber = 22;

     private bool hasField22;

-    private long field22_ = 0L;

+    private long field22_;

     public bool HasField22 {

       get { return hasField22; }

     }

@@ -282,7 +282,7 @@
     

     public const int Field59FieldNumber = 59;

     private bool hasField59;

-    private bool field59_ = false;

+    private bool field59_;

     public bool HasField59 {

       get { return hasField59; }

     }

@@ -302,7 +302,7 @@
     

     public const int Field16FieldNumber = 16;

     private bool hasField16;

-    private int field16_ = 0;

+    private int field16_;

     public bool HasField16 {

       get { return hasField16; }

     }

@@ -312,7 +312,7 @@
     

     public const int Field130FieldNumber = 130;

     private bool hasField130;

-    private int field130_ = 0;

+    private int field130_;

     public bool HasField130 {

       get { return hasField130; }

     }

@@ -362,7 +362,7 @@
     

     public const int Field104FieldNumber = 104;

     private bool hasField104;

-    private int field104_ = 0;

+    private int field104_;

     public bool HasField104 {

       get { return hasField104; }

     }

@@ -372,7 +372,7 @@
     

     public const int Field100FieldNumber = 100;

     private bool hasField100;

-    private int field100_ = 0;

+    private int field100_;

     public bool HasField100 {

       get { return hasField100; }

     }

@@ -382,7 +382,7 @@
     

     public const int Field101FieldNumber = 101;

     private bool hasField101;

-    private int field101_ = 0;

+    private int field101_;

     public bool HasField101 {

       get { return hasField101; }

     }

@@ -412,7 +412,7 @@
     

     public const int Field29FieldNumber = 29;

     private bool hasField29;

-    private int field29_ = 0;

+    private int field29_;

     public bool HasField29 {

       get { return hasField29; }

     }

@@ -422,7 +422,7 @@
     

     public const int Field30FieldNumber = 30;

     private bool hasField30;

-    private bool field30_ = false;

+    private bool field30_;

     public bool HasField30 {

       get { return hasField30; }

     }

@@ -462,7 +462,7 @@
     

     public const int Field150FieldNumber = 150;

     private bool hasField150;

-    private int field150_ = 0;

+    private int field150_;

     public bool HasField150 {

       get { return hasField150; }

     }

@@ -472,7 +472,7 @@
     

     public const int Field23FieldNumber = 23;

     private bool hasField23;

-    private int field23_ = 0;

+    private int field23_;

     public bool HasField23 {

       get { return hasField23; }

     }

@@ -482,7 +482,7 @@
     

     public const int Field24FieldNumber = 24;

     private bool hasField24;

-    private bool field24_ = false;

+    private bool field24_;

     public bool HasField24 {

       get { return hasField24; }

     }

@@ -492,7 +492,7 @@
     

     public const int Field25FieldNumber = 25;

     private bool hasField25;

-    private int field25_ = 0;

+    private int field25_;

     public bool HasField25 {

       get { return hasField25; }

     }

@@ -512,7 +512,7 @@
     

     public const int Field78FieldNumber = 78;

     private bool hasField78;

-    private bool field78_ = false;

+    private bool field78_;

     public bool HasField78 {

       get { return hasField78; }

     }

@@ -522,7 +522,7 @@
     

     public const int Field67FieldNumber = 67;

     private bool hasField67;

-    private int field67_ = 0;

+    private int field67_;

     public bool HasField67 {

       get { return hasField67; }

     }

@@ -532,7 +532,7 @@
     

     public const int Field68FieldNumber = 68;

     private bool hasField68;

-    private int field68_ = 0;

+    private int field68_;

     public bool HasField68 {

       get { return hasField68; }

     }

@@ -542,7 +542,7 @@
     

     public const int Field128FieldNumber = 128;

     private bool hasField128;

-    private int field128_ = 0;

+    private int field128_;

     public bool HasField128 {

       get { return hasField128; }

     }

@@ -562,7 +562,7 @@
     

     public const int Field131FieldNumber = 131;

     private bool hasField131;

-    private int field131_ = 0;

+    private int field131_;

     public bool HasField131 {

       get { return hasField131; }

     }

@@ -1459,7 +1459,7 @@
     

     public const int Field1FieldNumber = 1;

     private bool hasField1;

-    private int field1_ = 0;

+    private int field1_;

     public bool HasField1 {

       get { return hasField1; }

     }

@@ -1469,7 +1469,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private int field2_ = 0;

+    private int field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -1479,7 +1479,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private int field3_ = 0;

+    private int field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -1509,7 +1509,7 @@
     

     public const int Field13FieldNumber = 13;

     private bool hasField13;

-    private long field13_ = 0L;

+    private long field13_;

     public bool HasField13 {

       get { return hasField13; }

     }

@@ -1519,7 +1519,7 @@
     

     public const int Field14FieldNumber = 14;

     private bool hasField14;

-    private long field14_ = 0L;

+    private long field14_;

     public bool HasField14 {

       get { return hasField14; }

     }

@@ -1529,7 +1529,7 @@
     

     public const int Field16FieldNumber = 16;

     private bool hasField16;

-    private int field16_ = 0;

+    private int field16_;

     public bool HasField16 {

       get { return hasField16; }

     }

@@ -1569,7 +1569,7 @@
     

     public const int Field21FieldNumber = 21;

     private bool hasField21;

-    private ulong field21_ = 0;

+    private ulong field21_;

     public bool HasField21 {

       get { return hasField21; }

     }

@@ -1580,7 +1580,7 @@
     

     public const int Field22FieldNumber = 22;

     private bool hasField22;

-    private int field22_ = 0;

+    private int field22_;

     public bool HasField22 {

       get { return hasField22; }

     }

@@ -1590,7 +1590,7 @@
     

     public const int Field23FieldNumber = 23;

     private bool hasField23;

-    private bool field23_ = false;

+    private bool field23_;

     public bool HasField23 {

       get { return hasField23; }

     }

@@ -1600,7 +1600,7 @@
     

     public const int Field206FieldNumber = 206;

     private bool hasField206;

-    private bool field206_ = false;

+    private bool field206_;

     public bool HasField206 {

       get { return hasField206; }

     }

@@ -1610,7 +1610,7 @@
     

     public const int Field203FieldNumber = 203;

     private bool hasField203;

-    private uint field203_ = 0;

+    private uint field203_;

     public bool HasField203 {

       get { return hasField203; }

     }

@@ -1621,7 +1621,7 @@
     

     public const int Field204FieldNumber = 204;

     private bool hasField204;

-    private int field204_ = 0;

+    private int field204_;

     public bool HasField204 {

       get { return hasField204; }

     }

@@ -1641,7 +1641,7 @@
     

     public const int Field207FieldNumber = 207;

     private bool hasField207;

-    private ulong field207_ = 0UL;

+    private ulong field207_;

     public bool HasField207 {

       get { return hasField207; }

     }

@@ -1652,7 +1652,7 @@
     

     public const int Field300FieldNumber = 300;

     private bool hasField300;

-    private ulong field300_ = 0UL;

+    private ulong field300_;

     public bool HasField300 {

       get { return hasField300; }

     }

@@ -2172,7 +2172,7 @@
         

         public const int Field11FieldNumber = 11;

         private bool hasField11;

-        private float field11_ = 0F;

+        private float field11_;

         public bool HasField11 {

           get { return hasField11; }

         }

@@ -2182,7 +2182,7 @@
         

         public const int Field26FieldNumber = 26;

         private bool hasField26;

-        private float field26_ = 0F;

+        private float field26_;

         public bool HasField26 {

           get { return hasField26; }

         }

@@ -2224,7 +2224,7 @@
         

         public const int Field15FieldNumber = 15;

         private bool hasField15;

-        private ulong field15_ = 0UL;

+        private ulong field15_;

         public bool HasField15 {

           get { return hasField15; }

         }

@@ -2235,7 +2235,7 @@
         

         public const int Field5FieldNumber = 5;

         private bool hasField5;

-        private int field5_ = 0;

+        private int field5_;

         public bool HasField5 {

           get { return hasField5; }

         }

@@ -2255,7 +2255,7 @@
         

         public const int Field28FieldNumber = 28;

         private bool hasField28;

-        private int field28_ = 0;

+        private int field28_;

         public bool HasField28 {

           get { return hasField28; }

         }

@@ -2309,7 +2309,7 @@
         

         public const int Field20FieldNumber = 20;

         private bool hasField20;

-        private int field20_ = 0;

+        private int field20_;

         public bool HasField20 {

           get { return hasField20; }

         }

@@ -2781,7 +2781,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private long field3_ = 0L;

+    private long field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -2791,7 +2791,7 @@
     

     public const int Field4FieldNumber = 4;

     private bool hasField4;

-    private long field4_ = 0L;

+    private long field4_;

     public bool HasField4 {

       get { return hasField4; }

     }

@@ -2801,7 +2801,7 @@
     

     public const int Field30FieldNumber = 30;

     private bool hasField30;

-    private long field30_ = 0L;

+    private long field30_;

     public bool HasField30 {

       get { return hasField30; }

     }

@@ -2811,7 +2811,7 @@
     

     public const int Field75FieldNumber = 75;

     private bool hasField75;

-    private bool field75_ = false;

+    private bool field75_;

     public bool HasField75 {

       get { return hasField75; }

     }

@@ -2841,7 +2841,7 @@
     

     public const int Field21FieldNumber = 21;

     private bool hasField21;

-    private int field21_ = 0;

+    private int field21_;

     public bool HasField21 {

       get { return hasField21; }

     }

@@ -2851,7 +2851,7 @@
     

     public const int Field71FieldNumber = 71;

     private bool hasField71;

-    private int field71_ = 0;

+    private int field71_;

     public bool HasField71 {

       get { return hasField71; }

     }

@@ -2861,7 +2861,7 @@
     

     public const int Field25FieldNumber = 25;

     private bool hasField25;

-    private float field25_ = 0F;

+    private float field25_;

     public bool HasField25 {

       get { return hasField25; }

     }

@@ -2871,7 +2871,7 @@
     

     public const int Field109FieldNumber = 109;

     private bool hasField109;

-    private int field109_ = 0;

+    private int field109_;

     public bool HasField109 {

       get { return hasField109; }

     }

@@ -2881,7 +2881,7 @@
     

     public const int Field210FieldNumber = 210;

     private bool hasField210;

-    private int field210_ = 0;

+    private int field210_;

     public bool HasField210 {

       get { return hasField210; }

     }

@@ -2891,7 +2891,7 @@
     

     public const int Field211FieldNumber = 211;

     private bool hasField211;

-    private int field211_ = 0;

+    private int field211_;

     public bool HasField211 {

       get { return hasField211; }

     }

@@ -2901,7 +2901,7 @@
     

     public const int Field212FieldNumber = 212;

     private bool hasField212;

-    private int field212_ = 0;

+    private int field212_;

     public bool HasField212 {

       get { return hasField212; }

     }

@@ -2911,7 +2911,7 @@
     

     public const int Field213FieldNumber = 213;

     private bool hasField213;

-    private int field213_ = 0;

+    private int field213_;

     public bool HasField213 {

       get { return hasField213; }

     }

@@ -2921,7 +2921,7 @@
     

     public const int Field216FieldNumber = 216;

     private bool hasField216;

-    private int field216_ = 0;

+    private int field216_;

     public bool HasField216 {

       get { return hasField216; }

     }

@@ -2931,7 +2931,7 @@
     

     public const int Field217FieldNumber = 217;

     private bool hasField217;

-    private int field217_ = 0;

+    private int field217_;

     public bool HasField217 {

       get { return hasField217; }

     }

@@ -2941,7 +2941,7 @@
     

     public const int Field218FieldNumber = 218;

     private bool hasField218;

-    private int field218_ = 0;

+    private int field218_;

     public bool HasField218 {

       get { return hasField218; }

     }

@@ -2951,7 +2951,7 @@
     

     public const int Field220FieldNumber = 220;

     private bool hasField220;

-    private int field220_ = 0;

+    private int field220_;

     public bool HasField220 {

       get { return hasField220; }

     }

@@ -2961,7 +2961,7 @@
     

     public const int Field221FieldNumber = 221;

     private bool hasField221;

-    private int field221_ = 0;

+    private int field221_;

     public bool HasField221 {

       get { return hasField221; }

     }

@@ -2971,7 +2971,7 @@
     

     public const int Field222FieldNumber = 222;

     private bool hasField222;

-    private float field222_ = 0F;

+    private float field222_;

     public bool HasField222 {

       get { return hasField222; }

     }

@@ -2981,7 +2981,7 @@
     

     public const int Field63FieldNumber = 63;

     private bool hasField63;

-    private int field63_ = 0;

+    private int field63_;

     public bool HasField63 {

       get { return hasField63; }

     }

@@ -3015,7 +3015,7 @@
     

     public const int Field131FieldNumber = 131;

     private bool hasField131;

-    private long field131_ = 0L;

+    private long field131_;

     public bool HasField131 {

       get { return hasField131; }

     }

@@ -3037,7 +3037,7 @@
     

     public const int Field129FieldNumber = 129;

     private bool hasField129;

-    private int field129_ = 0;

+    private int field129_;

     public bool HasField129 {

       get { return hasField129; }

     }

@@ -3059,7 +3059,7 @@
     

     public const int Field205FieldNumber = 205;

     private bool hasField205;

-    private bool field205_ = false;

+    private bool field205_;

     public bool HasField205 {

       get { return hasField205; }

     }

@@ -3069,7 +3069,7 @@
     

     public const int Field206FieldNumber = 206;

     private bool hasField206;

-    private bool field206_ = false;

+    private bool field206_;

     public bool HasField206 {

       get { return hasField206; }

     }

@@ -3783,7 +3783,7 @@
     

     public const int Field1FieldNumber = 1;

     private bool hasField1;

-    private float field1_ = 0F;

+    private float field1_;

     public bool HasField1 {

       get { return hasField1; }

     }

@@ -3793,7 +3793,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private float field2_ = 0F;

+    private float field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -3803,7 +3803,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private float field3_ = 0F;

+    private float field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -3813,7 +3813,7 @@
     

     public const int Field4FieldNumber = 4;

     private bool hasField4;

-    private bool field4_ = false;

+    private bool field4_;

     public bool HasField4 {

       get { return hasField4; }

     }

@@ -3823,7 +3823,7 @@
     

     public const int Field5FieldNumber = 5;

     private bool hasField5;

-    private bool field5_ = false;

+    private bool field5_;

     public bool HasField5 {

       get { return hasField5; }

     }

@@ -3843,7 +3843,7 @@
     

     public const int Field7FieldNumber = 7;

     private bool hasField7;

-    private bool field7_ = false;

+    private bool field7_;

     public bool HasField7 {

       get { return hasField7; }

     }

@@ -3853,7 +3853,7 @@
     

     public const int Field8FieldNumber = 8;

     private bool hasField8;

-    private float field8_ = 0F;

+    private float field8_;

     public bool HasField8 {

       get { return hasField8; }

     }

@@ -3863,7 +3863,7 @@
     

     public const int Field9FieldNumber = 9;

     private bool hasField9;

-    private bool field9_ = false;

+    private bool field9_;

     public bool HasField9 {

       get { return hasField9; }

     }

@@ -3873,7 +3873,7 @@
     

     public const int Field10FieldNumber = 10;

     private bool hasField10;

-    private float field10_ = 0F;

+    private float field10_;

     public bool HasField10 {

       get { return hasField10; }

     }

@@ -3883,7 +3883,7 @@
     

     public const int Field11FieldNumber = 11;

     private bool hasField11;

-    private long field11_ = 0L;

+    private long field11_;

     public bool HasField11 {

       get { return hasField11; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs
index f54a54b..7d4a65b 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs
@@ -190,7 +190,7 @@
     

     public const int Field80FieldNumber = 80;

     private bool hasField80;

-    private bool field80_ = false;

+    private bool field80_;

     public bool HasField80 {

       get { return hasField80; }

     }

@@ -210,7 +210,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private int field2_ = 0;

+    private int field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -220,7 +220,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private int field3_ = 0;

+    private int field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -230,7 +230,7 @@
     

     public const int Field280FieldNumber = 280;

     private bool hasField280;

-    private int field280_ = 0;

+    private int field280_;

     public bool HasField280 {

       get { return hasField280; }

     }

@@ -240,7 +240,7 @@
     

     public const int Field6FieldNumber = 6;

     private bool hasField6;

-    private int field6_ = 0;

+    private int field6_;

     public bool HasField6 {

       get { return hasField6; }

     }

@@ -250,7 +250,7 @@
     

     public const int Field22FieldNumber = 22;

     private bool hasField22;

-    private long field22_ = 0L;

+    private long field22_;

     public bool HasField22 {

       get { return hasField22; }

     }

@@ -284,7 +284,7 @@
     

     public const int Field59FieldNumber = 59;

     private bool hasField59;

-    private bool field59_ = false;

+    private bool field59_;

     public bool HasField59 {

       get { return hasField59; }

     }

@@ -304,7 +304,7 @@
     

     public const int Field16FieldNumber = 16;

     private bool hasField16;

-    private int field16_ = 0;

+    private int field16_;

     public bool HasField16 {

       get { return hasField16; }

     }

@@ -314,7 +314,7 @@
     

     public const int Field130FieldNumber = 130;

     private bool hasField130;

-    private int field130_ = 0;

+    private int field130_;

     public bool HasField130 {

       get { return hasField130; }

     }

@@ -364,7 +364,7 @@
     

     public const int Field104FieldNumber = 104;

     private bool hasField104;

-    private int field104_ = 0;

+    private int field104_;

     public bool HasField104 {

       get { return hasField104; }

     }

@@ -374,7 +374,7 @@
     

     public const int Field100FieldNumber = 100;

     private bool hasField100;

-    private int field100_ = 0;

+    private int field100_;

     public bool HasField100 {

       get { return hasField100; }

     }

@@ -384,7 +384,7 @@
     

     public const int Field101FieldNumber = 101;

     private bool hasField101;

-    private int field101_ = 0;

+    private int field101_;

     public bool HasField101 {

       get { return hasField101; }

     }

@@ -414,7 +414,7 @@
     

     public const int Field29FieldNumber = 29;

     private bool hasField29;

-    private int field29_ = 0;

+    private int field29_;

     public bool HasField29 {

       get { return hasField29; }

     }

@@ -424,7 +424,7 @@
     

     public const int Field30FieldNumber = 30;

     private bool hasField30;

-    private bool field30_ = false;

+    private bool field30_;

     public bool HasField30 {

       get { return hasField30; }

     }

@@ -464,7 +464,7 @@
     

     public const int Field150FieldNumber = 150;

     private bool hasField150;

-    private int field150_ = 0;

+    private int field150_;

     public bool HasField150 {

       get { return hasField150; }

     }

@@ -474,7 +474,7 @@
     

     public const int Field23FieldNumber = 23;

     private bool hasField23;

-    private int field23_ = 0;

+    private int field23_;

     public bool HasField23 {

       get { return hasField23; }

     }

@@ -484,7 +484,7 @@
     

     public const int Field24FieldNumber = 24;

     private bool hasField24;

-    private bool field24_ = false;

+    private bool field24_;

     public bool HasField24 {

       get { return hasField24; }

     }

@@ -494,7 +494,7 @@
     

     public const int Field25FieldNumber = 25;

     private bool hasField25;

-    private int field25_ = 0;

+    private int field25_;

     public bool HasField25 {

       get { return hasField25; }

     }

@@ -514,7 +514,7 @@
     

     public const int Field78FieldNumber = 78;

     private bool hasField78;

-    private bool field78_ = false;

+    private bool field78_;

     public bool HasField78 {

       get { return hasField78; }

     }

@@ -524,7 +524,7 @@
     

     public const int Field67FieldNumber = 67;

     private bool hasField67;

-    private int field67_ = 0;

+    private int field67_;

     public bool HasField67 {

       get { return hasField67; }

     }

@@ -534,7 +534,7 @@
     

     public const int Field68FieldNumber = 68;

     private bool hasField68;

-    private int field68_ = 0;

+    private int field68_;

     public bool HasField68 {

       get { return hasField68; }

     }

@@ -544,7 +544,7 @@
     

     public const int Field128FieldNumber = 128;

     private bool hasField128;

-    private int field128_ = 0;

+    private int field128_;

     public bool HasField128 {

       get { return hasField128; }

     }

@@ -564,7 +564,7 @@
     

     public const int Field131FieldNumber = 131;

     private bool hasField131;

-    private int field131_ = 0;

+    private int field131_;

     public bool HasField131 {

       get { return hasField131; }

     }

@@ -2095,7 +2095,7 @@
     

     public const int Field1FieldNumber = 1;

     private bool hasField1;

-    private int field1_ = 0;

+    private int field1_;

     public bool HasField1 {

       get { return hasField1; }

     }

@@ -2105,7 +2105,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private int field2_ = 0;

+    private int field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -2115,7 +2115,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private int field3_ = 0;

+    private int field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -2145,7 +2145,7 @@
     

     public const int Field13FieldNumber = 13;

     private bool hasField13;

-    private long field13_ = 0L;

+    private long field13_;

     public bool HasField13 {

       get { return hasField13; }

     }

@@ -2155,7 +2155,7 @@
     

     public const int Field14FieldNumber = 14;

     private bool hasField14;

-    private long field14_ = 0L;

+    private long field14_;

     public bool HasField14 {

       get { return hasField14; }

     }

@@ -2165,7 +2165,7 @@
     

     public const int Field16FieldNumber = 16;

     private bool hasField16;

-    private int field16_ = 0;

+    private int field16_;

     public bool HasField16 {

       get { return hasField16; }

     }

@@ -2205,7 +2205,7 @@
     

     public const int Field21FieldNumber = 21;

     private bool hasField21;

-    private ulong field21_ = 0;

+    private ulong field21_;

     public bool HasField21 {

       get { return hasField21; }

     }

@@ -2216,7 +2216,7 @@
     

     public const int Field22FieldNumber = 22;

     private bool hasField22;

-    private int field22_ = 0;

+    private int field22_;

     public bool HasField22 {

       get { return hasField22; }

     }

@@ -2226,7 +2226,7 @@
     

     public const int Field23FieldNumber = 23;

     private bool hasField23;

-    private bool field23_ = false;

+    private bool field23_;

     public bool HasField23 {

       get { return hasField23; }

     }

@@ -2236,7 +2236,7 @@
     

     public const int Field206FieldNumber = 206;

     private bool hasField206;

-    private bool field206_ = false;

+    private bool field206_;

     public bool HasField206 {

       get { return hasField206; }

     }

@@ -2246,7 +2246,7 @@
     

     public const int Field203FieldNumber = 203;

     private bool hasField203;

-    private uint field203_ = 0;

+    private uint field203_;

     public bool HasField203 {

       get { return hasField203; }

     }

@@ -2257,7 +2257,7 @@
     

     public const int Field204FieldNumber = 204;

     private bool hasField204;

-    private int field204_ = 0;

+    private int field204_;

     public bool HasField204 {

       get { return hasField204; }

     }

@@ -2277,7 +2277,7 @@
     

     public const int Field207FieldNumber = 207;

     private bool hasField207;

-    private ulong field207_ = 0UL;

+    private ulong field207_;

     public bool HasField207 {

       get { return hasField207; }

     }

@@ -2288,7 +2288,7 @@
     

     public const int Field300FieldNumber = 300;

     private bool hasField300;

-    private ulong field300_ = 0UL;

+    private ulong field300_;

     public bool HasField300 {

       get { return hasField300; }

     }

@@ -3159,7 +3159,7 @@
         

         public const int Field11FieldNumber = 11;

         private bool hasField11;

-        private float field11_ = 0F;

+        private float field11_;

         public bool HasField11 {

           get { return hasField11; }

         }

@@ -3169,7 +3169,7 @@
         

         public const int Field26FieldNumber = 26;

         private bool hasField26;

-        private float field26_ = 0F;

+        private float field26_;

         public bool HasField26 {

           get { return hasField26; }

         }

@@ -3211,7 +3211,7 @@
         

         public const int Field15FieldNumber = 15;

         private bool hasField15;

-        private ulong field15_ = 0UL;

+        private ulong field15_;

         public bool HasField15 {

           get { return hasField15; }

         }

@@ -3222,7 +3222,7 @@
         

         public const int Field5FieldNumber = 5;

         private bool hasField5;

-        private int field5_ = 0;

+        private int field5_;

         public bool HasField5 {

           get { return hasField5; }

         }

@@ -3242,7 +3242,7 @@
         

         public const int Field28FieldNumber = 28;

         private bool hasField28;

-        private int field28_ = 0;

+        private int field28_;

         public bool HasField28 {

           get { return hasField28; }

         }

@@ -3296,7 +3296,7 @@
         

         public const int Field20FieldNumber = 20;

         private bool hasField20;

-        private int field20_ = 0;

+        private int field20_;

         public bool HasField20 {

           get { return hasField20; }

         }

@@ -4086,7 +4086,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private long field3_ = 0L;

+    private long field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -4096,7 +4096,7 @@
     

     public const int Field4FieldNumber = 4;

     private bool hasField4;

-    private long field4_ = 0L;

+    private long field4_;

     public bool HasField4 {

       get { return hasField4; }

     }

@@ -4106,7 +4106,7 @@
     

     public const int Field30FieldNumber = 30;

     private bool hasField30;

-    private long field30_ = 0L;

+    private long field30_;

     public bool HasField30 {

       get { return hasField30; }

     }

@@ -4116,7 +4116,7 @@
     

     public const int Field75FieldNumber = 75;

     private bool hasField75;

-    private bool field75_ = false;

+    private bool field75_;

     public bool HasField75 {

       get { return hasField75; }

     }

@@ -4146,7 +4146,7 @@
     

     public const int Field21FieldNumber = 21;

     private bool hasField21;

-    private int field21_ = 0;

+    private int field21_;

     public bool HasField21 {

       get { return hasField21; }

     }

@@ -4156,7 +4156,7 @@
     

     public const int Field71FieldNumber = 71;

     private bool hasField71;

-    private int field71_ = 0;

+    private int field71_;

     public bool HasField71 {

       get { return hasField71; }

     }

@@ -4166,7 +4166,7 @@
     

     public const int Field25FieldNumber = 25;

     private bool hasField25;

-    private float field25_ = 0F;

+    private float field25_;

     public bool HasField25 {

       get { return hasField25; }

     }

@@ -4176,7 +4176,7 @@
     

     public const int Field109FieldNumber = 109;

     private bool hasField109;

-    private int field109_ = 0;

+    private int field109_;

     public bool HasField109 {

       get { return hasField109; }

     }

@@ -4186,7 +4186,7 @@
     

     public const int Field210FieldNumber = 210;

     private bool hasField210;

-    private int field210_ = 0;

+    private int field210_;

     public bool HasField210 {

       get { return hasField210; }

     }

@@ -4196,7 +4196,7 @@
     

     public const int Field211FieldNumber = 211;

     private bool hasField211;

-    private int field211_ = 0;

+    private int field211_;

     public bool HasField211 {

       get { return hasField211; }

     }

@@ -4206,7 +4206,7 @@
     

     public const int Field212FieldNumber = 212;

     private bool hasField212;

-    private int field212_ = 0;

+    private int field212_;

     public bool HasField212 {

       get { return hasField212; }

     }

@@ -4216,7 +4216,7 @@
     

     public const int Field213FieldNumber = 213;

     private bool hasField213;

-    private int field213_ = 0;

+    private int field213_;

     public bool HasField213 {

       get { return hasField213; }

     }

@@ -4226,7 +4226,7 @@
     

     public const int Field216FieldNumber = 216;

     private bool hasField216;

-    private int field216_ = 0;

+    private int field216_;

     public bool HasField216 {

       get { return hasField216; }

     }

@@ -4236,7 +4236,7 @@
     

     public const int Field217FieldNumber = 217;

     private bool hasField217;

-    private int field217_ = 0;

+    private int field217_;

     public bool HasField217 {

       get { return hasField217; }

     }

@@ -4246,7 +4246,7 @@
     

     public const int Field218FieldNumber = 218;

     private bool hasField218;

-    private int field218_ = 0;

+    private int field218_;

     public bool HasField218 {

       get { return hasField218; }

     }

@@ -4256,7 +4256,7 @@
     

     public const int Field220FieldNumber = 220;

     private bool hasField220;

-    private int field220_ = 0;

+    private int field220_;

     public bool HasField220 {

       get { return hasField220; }

     }

@@ -4266,7 +4266,7 @@
     

     public const int Field221FieldNumber = 221;

     private bool hasField221;

-    private int field221_ = 0;

+    private int field221_;

     public bool HasField221 {

       get { return hasField221; }

     }

@@ -4276,7 +4276,7 @@
     

     public const int Field222FieldNumber = 222;

     private bool hasField222;

-    private float field222_ = 0F;

+    private float field222_;

     public bool HasField222 {

       get { return hasField222; }

     }

@@ -4286,7 +4286,7 @@
     

     public const int Field63FieldNumber = 63;

     private bool hasField63;

-    private int field63_ = 0;

+    private int field63_;

     public bool HasField63 {

       get { return hasField63; }

     }

@@ -4320,7 +4320,7 @@
     

     public const int Field131FieldNumber = 131;

     private bool hasField131;

-    private long field131_ = 0L;

+    private long field131_;

     public bool HasField131 {

       get { return hasField131; }

     }

@@ -4342,7 +4342,7 @@
     

     public const int Field129FieldNumber = 129;

     private bool hasField129;

-    private int field129_ = 0;

+    private int field129_;

     public bool HasField129 {

       get { return hasField129; }

     }

@@ -4364,7 +4364,7 @@
     

     public const int Field205FieldNumber = 205;

     private bool hasField205;

-    private bool field205_ = false;

+    private bool field205_;

     public bool HasField205 {

       get { return hasField205; }

     }

@@ -4374,7 +4374,7 @@
     

     public const int Field206FieldNumber = 206;

     private bool hasField206;

-    private bool field206_ = false;

+    private bool field206_;

     public bool HasField206 {

       get { return hasField206; }

     }

@@ -5583,7 +5583,7 @@
     

     public const int Field1FieldNumber = 1;

     private bool hasField1;

-    private float field1_ = 0F;

+    private float field1_;

     public bool HasField1 {

       get { return hasField1; }

     }

@@ -5593,7 +5593,7 @@
     

     public const int Field2FieldNumber = 2;

     private bool hasField2;

-    private float field2_ = 0F;

+    private float field2_;

     public bool HasField2 {

       get { return hasField2; }

     }

@@ -5603,7 +5603,7 @@
     

     public const int Field3FieldNumber = 3;

     private bool hasField3;

-    private float field3_ = 0F;

+    private float field3_;

     public bool HasField3 {

       get { return hasField3; }

     }

@@ -5613,7 +5613,7 @@
     

     public const int Field4FieldNumber = 4;

     private bool hasField4;

-    private bool field4_ = false;

+    private bool field4_;

     public bool HasField4 {

       get { return hasField4; }

     }

@@ -5623,7 +5623,7 @@
     

     public const int Field5FieldNumber = 5;

     private bool hasField5;

-    private bool field5_ = false;

+    private bool field5_;

     public bool HasField5 {

       get { return hasField5; }

     }

@@ -5643,7 +5643,7 @@
     

     public const int Field7FieldNumber = 7;

     private bool hasField7;

-    private bool field7_ = false;

+    private bool field7_;

     public bool HasField7 {

       get { return hasField7; }

     }

@@ -5653,7 +5653,7 @@
     

     public const int Field8FieldNumber = 8;

     private bool hasField8;

-    private float field8_ = 0F;

+    private float field8_;

     public bool HasField8 {

       get { return hasField8; }

     }

@@ -5663,7 +5663,7 @@
     

     public const int Field9FieldNumber = 9;

     private bool hasField9;

-    private bool field9_ = false;

+    private bool field9_;

     public bool HasField9 {

       get { return hasField9; }

     }

@@ -5673,7 +5673,7 @@
     

     public const int Field10FieldNumber = 10;

     private bool hasField10;

-    private float field10_ = 0F;

+    private float field10_;

     public bool HasField10 {

       get { return hasField10; }

     }

@@ -5683,7 +5683,7 @@
     

     public const int Field11FieldNumber = 11;

     private bool hasField11;

-    private long field11_ = 0L;

+    private long field11_;

     public bool HasField11 {

       get { return hasField11; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs
index dc4ea54..3b869a3 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs
@@ -58,7 +58,7 @@
     

     public const int DFieldNumber = 1;

     private bool hasD;

-    private int d_ = 0;

+    private int d_;

     public bool HasD {

       get { return hasD; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
index adf6fd1..0f5bf32 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
@@ -94,7 +94,7 @@
     

     public const int DFieldNumber = 1;

     private bool hasD;

-    private int d_ = 0;

+    private int d_;

     public bool HasD {

       get { return hasD; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
index fe46892..ec1670f 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
@@ -593,7 +593,7 @@
     public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1> MessageSetExtension;

     public const int IFieldNumber = 15;

     private bool hasI;

-    private int i_ = 0;

+    private int i_;

     public bool HasI {

       get { return hasI; }

     }

@@ -1106,7 +1106,7 @@
         

         public const int TypeIdFieldNumber = 2;

         private bool hasTypeId;

-        private int typeId_ = 0;

+        private int typeId_;

         public bool HasTypeId {

           get { return hasTypeId; }

         }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
index 6706c94..d4bda6d 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
@@ -104,7 +104,7 @@
     

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
index c95191a..3418af9 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
@@ -110,7 +110,7 @@
     public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize> TestExtension2;

     public const int IFieldNumber = 1;

     private bool hasI;

-    private int i_ = 0;

+    private int i_;

     public bool HasI {

       get { return hasI; }

     }

@@ -293,7 +293,7 @@
     

     public const int XFieldNumber = 1;

     private bool hasX;

-    private int x_ = 0;

+    private int x_;

     public bool HasX {

       get { return hasX; }

     }

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
index bf7d0da..a3294ca 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
@@ -1185,7 +1185,7 @@
         

         public const int BbFieldNumber = 1;

         private bool hasBb;

-        private int bb_ = 0;

+        private int bb_;

         public bool HasBb {

           get { return hasBb; }

         }

@@ -1424,7 +1424,7 @@
         

         public const int AFieldNumber = 17;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1663,7 +1663,7 @@
         

         public const int AFieldNumber = 47;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1878,7 +1878,7 @@
     

     public const int OptionalInt32FieldNumber = 1;

     private bool hasOptionalInt32;

-    private int optionalInt32_ = 0;

+    private int optionalInt32_;

     public bool HasOptionalInt32 {

       get { return hasOptionalInt32; }

     }

@@ -1888,7 +1888,7 @@
     

     public const int OptionalInt64FieldNumber = 2;

     private bool hasOptionalInt64;

-    private long optionalInt64_ = 0L;

+    private long optionalInt64_;

     public bool HasOptionalInt64 {

       get { return hasOptionalInt64; }

     }

@@ -1898,7 +1898,7 @@
     

     public const int OptionalUint32FieldNumber = 3;

     private bool hasOptionalUint32;

-    private uint optionalUint32_ = 0;

+    private uint optionalUint32_;

     public bool HasOptionalUint32 {

       get { return hasOptionalUint32; }

     }

@@ -1909,7 +1909,7 @@
     

     public const int OptionalUint64FieldNumber = 4;

     private bool hasOptionalUint64;

-    private ulong optionalUint64_ = 0UL;

+    private ulong optionalUint64_;

     public bool HasOptionalUint64 {

       get { return hasOptionalUint64; }

     }

@@ -1920,7 +1920,7 @@
     

     public const int OptionalSint32FieldNumber = 5;

     private bool hasOptionalSint32;

-    private int optionalSint32_ = 0;

+    private int optionalSint32_;

     public bool HasOptionalSint32 {

       get { return hasOptionalSint32; }

     }

@@ -1930,7 +1930,7 @@
     

     public const int OptionalSint64FieldNumber = 6;

     private bool hasOptionalSint64;

-    private long optionalSint64_ = 0;

+    private long optionalSint64_;

     public bool HasOptionalSint64 {

       get { return hasOptionalSint64; }

     }

@@ -1940,7 +1940,7 @@
     

     public const int OptionalFixed32FieldNumber = 7;

     private bool hasOptionalFixed32;

-    private uint optionalFixed32_ = 0;

+    private uint optionalFixed32_;

     public bool HasOptionalFixed32 {

       get { return hasOptionalFixed32; }

     }

@@ -1951,7 +1951,7 @@
     

     public const int OptionalFixed64FieldNumber = 8;

     private bool hasOptionalFixed64;

-    private ulong optionalFixed64_ = 0;

+    private ulong optionalFixed64_;

     public bool HasOptionalFixed64 {

       get { return hasOptionalFixed64; }

     }

@@ -1962,7 +1962,7 @@
     

     public const int OptionalSfixed32FieldNumber = 9;

     private bool hasOptionalSfixed32;

-    private int optionalSfixed32_ = 0;

+    private int optionalSfixed32_;

     public bool HasOptionalSfixed32 {

       get { return hasOptionalSfixed32; }

     }

@@ -1972,7 +1972,7 @@
     

     public const int OptionalSfixed64FieldNumber = 10;

     private bool hasOptionalSfixed64;

-    private long optionalSfixed64_ = 0;

+    private long optionalSfixed64_;

     public bool HasOptionalSfixed64 {

       get { return hasOptionalSfixed64; }

     }

@@ -1982,7 +1982,7 @@
     

     public const int OptionalFloatFieldNumber = 11;

     private bool hasOptionalFloat;

-    private float optionalFloat_ = 0F;

+    private float optionalFloat_;

     public bool HasOptionalFloat {

       get { return hasOptionalFloat; }

     }

@@ -1992,7 +1992,7 @@
     

     public const int OptionalDoubleFieldNumber = 12;

     private bool hasOptionalDouble;

-    private double optionalDouble_ = 0D;

+    private double optionalDouble_;

     public bool HasOptionalDouble {

       get { return hasOptionalDouble; }

     }

@@ -2002,7 +2002,7 @@
     

     public const int OptionalBoolFieldNumber = 13;

     private bool hasOptionalBool;

-    private bool optionalBool_ = false;

+    private bool optionalBool_;

     public bool HasOptionalBool {

       get { return hasOptionalBool; }

     }

@@ -2687,13 +2687,13 @@
         output.WriteMessage(20, field_names[30], OptionalImportMessage);

       }

       if (hasOptionalNestedEnum) {

-        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum.ToString());

+        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum);

       }

       if (hasOptionalForeignEnum) {

-        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum.ToString());

+        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum);

       }

       if (hasOptionalImportEnum) {

-        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum.ToString());

+        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum);

       }

       if (hasOptionalStringPiece) {

         output.WriteString(24, field_names[40], OptionalStringPiece);

@@ -2819,13 +2819,13 @@
         output.WriteBytes(75, field_names[1], DefaultBytes);

       }

       if (hasDefaultNestedEnum) {

-        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum.ToString());

+        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum);

       }

       if (hasDefaultForeignEnum) {

-        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum.ToString());

+        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum);

       }

       if (hasDefaultImportEnum) {

-        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum.ToString());

+        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum);

       }

       if (hasDefaultStringPiece) {

         output.WriteString(84, field_names[17], DefaultStringPiece);

@@ -5519,7 +5519,7 @@
     

     public const int DeprecatedInt32FieldNumber = 1;

     private bool hasDeprecatedInt32;

-    private int deprecatedInt32_ = 0;

+    private int deprecatedInt32_;

     public bool HasDeprecatedInt32 {

       get { return hasDeprecatedInt32; }

     }

@@ -5758,7 +5758,7 @@
     

     public const int CFieldNumber = 1;

     private bool hasC;

-    private int c_ = 0;

+    private int c_;

     public bool HasC {

       get { return hasC; }

     }

@@ -6200,7 +6200,7 @@
     

     public const int AFieldNumber = 17;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6439,7 +6439,7 @@
     

     public const int AFieldNumber = 47;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6882,7 +6882,7 @@
     public static pb::GeneratedExtensionBase<scg::IList<global::Google.ProtocolBuffers.TestProtos.TestRequired>> Multi;

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6892,7 +6892,7 @@
     

     public const int Dummy2FieldNumber = 2;

     private bool hasDummy2;

-    private int dummy2_ = 0;

+    private int dummy2_;

     public bool HasDummy2 {

       get { return hasDummy2; }

     }

@@ -6902,7 +6902,7 @@
     

     public const int BFieldNumber = 3;

     private bool hasB;

-    private int b_ = 0;

+    private int b_;

     public bool HasB {

       get { return hasB; }

     }

@@ -6912,7 +6912,7 @@
     

     public const int Dummy4FieldNumber = 4;

     private bool hasDummy4;

-    private int dummy4_ = 0;

+    private int dummy4_;

     public bool HasDummy4 {

       get { return hasDummy4; }

     }

@@ -6922,7 +6922,7 @@
     

     public const int Dummy5FieldNumber = 5;

     private bool hasDummy5;

-    private int dummy5_ = 0;

+    private int dummy5_;

     public bool HasDummy5 {

       get { return hasDummy5; }

     }

@@ -6932,7 +6932,7 @@
     

     public const int Dummy6FieldNumber = 6;

     private bool hasDummy6;

-    private int dummy6_ = 0;

+    private int dummy6_;

     public bool HasDummy6 {

       get { return hasDummy6; }

     }

@@ -6942,7 +6942,7 @@
     

     public const int Dummy7FieldNumber = 7;

     private bool hasDummy7;

-    private int dummy7_ = 0;

+    private int dummy7_;

     public bool HasDummy7 {

       get { return hasDummy7; }

     }

@@ -6952,7 +6952,7 @@
     

     public const int Dummy8FieldNumber = 8;

     private bool hasDummy8;

-    private int dummy8_ = 0;

+    private int dummy8_;

     public bool HasDummy8 {

       get { return hasDummy8; }

     }

@@ -6962,7 +6962,7 @@
     

     public const int Dummy9FieldNumber = 9;

     private bool hasDummy9;

-    private int dummy9_ = 0;

+    private int dummy9_;

     public bool HasDummy9 {

       get { return hasDummy9; }

     }

@@ -6972,7 +6972,7 @@
     

     public const int Dummy10FieldNumber = 10;

     private bool hasDummy10;

-    private int dummy10_ = 0;

+    private int dummy10_;

     public bool HasDummy10 {

       get { return hasDummy10; }

     }

@@ -6982,7 +6982,7 @@
     

     public const int Dummy11FieldNumber = 11;

     private bool hasDummy11;

-    private int dummy11_ = 0;

+    private int dummy11_;

     public bool HasDummy11 {

       get { return hasDummy11; }

     }

@@ -6992,7 +6992,7 @@
     

     public const int Dummy12FieldNumber = 12;

     private bool hasDummy12;

-    private int dummy12_ = 0;

+    private int dummy12_;

     public bool HasDummy12 {

       get { return hasDummy12; }

     }

@@ -7002,7 +7002,7 @@
     

     public const int Dummy13FieldNumber = 13;

     private bool hasDummy13;

-    private int dummy13_ = 0;

+    private int dummy13_;

     public bool HasDummy13 {

       get { return hasDummy13; }

     }

@@ -7012,7 +7012,7 @@
     

     public const int Dummy14FieldNumber = 14;

     private bool hasDummy14;

-    private int dummy14_ = 0;

+    private int dummy14_;

     public bool HasDummy14 {

       get { return hasDummy14; }

     }

@@ -7022,7 +7022,7 @@
     

     public const int Dummy15FieldNumber = 15;

     private bool hasDummy15;

-    private int dummy15_ = 0;

+    private int dummy15_;

     public bool HasDummy15 {

       get { return hasDummy15; }

     }

@@ -7032,7 +7032,7 @@
     

     public const int Dummy16FieldNumber = 16;

     private bool hasDummy16;

-    private int dummy16_ = 0;

+    private int dummy16_;

     public bool HasDummy16 {

       get { return hasDummy16; }

     }

@@ -7042,7 +7042,7 @@
     

     public const int Dummy17FieldNumber = 17;

     private bool hasDummy17;

-    private int dummy17_ = 0;

+    private int dummy17_;

     public bool HasDummy17 {

       get { return hasDummy17; }

     }

@@ -7052,7 +7052,7 @@
     

     public const int Dummy18FieldNumber = 18;

     private bool hasDummy18;

-    private int dummy18_ = 0;

+    private int dummy18_;

     public bool HasDummy18 {

       get { return hasDummy18; }

     }

@@ -7062,7 +7062,7 @@
     

     public const int Dummy19FieldNumber = 19;

     private bool hasDummy19;

-    private int dummy19_ = 0;

+    private int dummy19_;

     public bool HasDummy19 {

       get { return hasDummy19; }

     }

@@ -7072,7 +7072,7 @@
     

     public const int Dummy20FieldNumber = 20;

     private bool hasDummy20;

-    private int dummy20_ = 0;

+    private int dummy20_;

     public bool HasDummy20 {

       get { return hasDummy20; }

     }

@@ -7082,7 +7082,7 @@
     

     public const int Dummy21FieldNumber = 21;

     private bool hasDummy21;

-    private int dummy21_ = 0;

+    private int dummy21_;

     public bool HasDummy21 {

       get { return hasDummy21; }

     }

@@ -7092,7 +7092,7 @@
     

     public const int Dummy22FieldNumber = 22;

     private bool hasDummy22;

-    private int dummy22_ = 0;

+    private int dummy22_;

     public bool HasDummy22 {

       get { return hasDummy22; }

     }

@@ -7102,7 +7102,7 @@
     

     public const int Dummy23FieldNumber = 23;

     private bool hasDummy23;

-    private int dummy23_ = 0;

+    private int dummy23_;

     public bool HasDummy23 {

       get { return hasDummy23; }

     }

@@ -7112,7 +7112,7 @@
     

     public const int Dummy24FieldNumber = 24;

     private bool hasDummy24;

-    private int dummy24_ = 0;

+    private int dummy24_;

     public bool HasDummy24 {

       get { return hasDummy24; }

     }

@@ -7122,7 +7122,7 @@
     

     public const int Dummy25FieldNumber = 25;

     private bool hasDummy25;

-    private int dummy25_ = 0;

+    private int dummy25_;

     public bool HasDummy25 {

       get { return hasDummy25; }

     }

@@ -7132,7 +7132,7 @@
     

     public const int Dummy26FieldNumber = 26;

     private bool hasDummy26;

-    private int dummy26_ = 0;

+    private int dummy26_;

     public bool HasDummy26 {

       get { return hasDummy26; }

     }

@@ -7142,7 +7142,7 @@
     

     public const int Dummy27FieldNumber = 27;

     private bool hasDummy27;

-    private int dummy27_ = 0;

+    private int dummy27_;

     public bool HasDummy27 {

       get { return hasDummy27; }

     }

@@ -7152,7 +7152,7 @@
     

     public const int Dummy28FieldNumber = 28;

     private bool hasDummy28;

-    private int dummy28_ = 0;

+    private int dummy28_;

     public bool HasDummy28 {

       get { return hasDummy28; }

     }

@@ -7162,7 +7162,7 @@
     

     public const int Dummy29FieldNumber = 29;

     private bool hasDummy29;

-    private int dummy29_ = 0;

+    private int dummy29_;

     public bool HasDummy29 {

       get { return hasDummy29; }

     }

@@ -7172,7 +7172,7 @@
     

     public const int Dummy30FieldNumber = 30;

     private bool hasDummy30;

-    private int dummy30_ = 0;

+    private int dummy30_;

     public bool HasDummy30 {

       get { return hasDummy30; }

     }

@@ -7182,7 +7182,7 @@
     

     public const int Dummy31FieldNumber = 31;

     private bool hasDummy31;

-    private int dummy31_ = 0;

+    private int dummy31_;

     public bool HasDummy31 {

       get { return hasDummy31; }

     }

@@ -7192,7 +7192,7 @@
     

     public const int Dummy32FieldNumber = 32;

     private bool hasDummy32;

-    private int dummy32_ = 0;

+    private int dummy32_;

     public bool HasDummy32 {

       get { return hasDummy32; }

     }

@@ -7202,7 +7202,7 @@
     

     public const int CFieldNumber = 33;

     private bool hasC;

-    private int c_ = 0;

+    private int c_;

     public bool HasC {

       get { return hasC; }

     }

@@ -8458,7 +8458,7 @@
     

     public const int DummyFieldNumber = 3;

     private bool hasDummy;

-    private int dummy_ = 0;

+    private int dummy_;

     public bool HasDummy {

       get { return hasDummy; }

     }

@@ -9677,7 +9677,7 @@
     

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -9687,7 +9687,7 @@
     

     public const int BbFieldNumber = 268435455;

     private bool hasBb;

-    private int bb_ = 0;

+    private int bb_;

     public bool HasBb {

       get { return hasBb; }

     }

@@ -9967,7 +9967,7 @@
     

     public const int IFieldNumber = 2;

     private bool hasI;

-    private int i_ = 0;

+    private int i_;

     public bool HasI {

       get { return hasI; }

     }

@@ -10532,7 +10532,7 @@
     

     public const int OptionalInt32FieldNumber = 2;

     private bool hasOptionalInt32;

-    private int optionalInt32_ = 0;

+    private int optionalInt32_;

     public bool HasOptionalInt32 {

       get { return hasOptionalInt32; }

     }

@@ -10857,7 +10857,7 @@
         

         public const int AFieldNumber = 1;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -11096,7 +11096,7 @@
         

         public const int AFieldNumber = 1;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -11311,7 +11311,7 @@
     

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -12268,7 +12268,7 @@
     

     public const int PrimitiveFieldFieldNumber = 1;

     private bool hasPrimitiveField;

-    private int primitiveField_ = 0;

+    private int primitiveField_;

     public bool HasPrimitiveField {

       get { return hasPrimitiveField; }

     }

@@ -12414,7 +12414,7 @@
         output.WriteString(2, field_names[10], StringField);

       }

       if (hasEnumField) {

-        output.WriteEnum(3, field_names[1], (int) EnumField, EnumField.ToString());

+        output.WriteEnum(3, field_names[1], (int) EnumField, EnumField);

       }

       if (hasMessageField) {

         output.WriteMessage(4, field_names[2], MessageField);

@@ -13124,7 +13124,7 @@
     

     public const int MyIntFieldNumber = 1;

     private bool hasMyInt;

-    private long myInt_ = 0L;

+    private long myInt_;

     public bool HasMyInt {

       get { return hasMyInt; }

     }

@@ -13134,7 +13134,7 @@
     

     public const int MyFloatFieldNumber = 101;

     private bool hasMyFloat;

-    private float myFloat_ = 0F;

+    private float myFloat_;

     public bool HasMyFloat {

       get { return hasMyFloat; }

     }

@@ -13504,7 +13504,7 @@
     

     public const int ZeroFloatFieldNumber = 7;

     private bool hasZeroFloat;

-    private float zeroFloat_ = 0F;

+    private float zeroFloat_;

     public bool HasZeroFloat {

       get { return hasZeroFloat; }

     }

@@ -17478,7 +17478,7 @@
         

         public const int DynamicFieldFieldNumber = 2100;

         private bool hasDynamicField;

-        private int dynamicField_ = 0;

+        private int dynamicField_;

         public bool HasDynamicField {

           get { return hasDynamicField; }

         }

@@ -17693,7 +17693,7 @@
     

     public const int ScalarExtensionFieldNumber = 2000;

     private bool hasScalarExtension;

-    private uint scalarExtension_ = 0;

+    private uint scalarExtension_;

     public bool HasScalarExtension {

       get { return hasScalarExtension; }

     }

@@ -17780,10 +17780,10 @@
         output.WriteFixed32(2000, field_names[6], ScalarExtension);

       }

       if (hasEnumExtension) {

-        output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension.ToString());

+        output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension);

       }

       if (hasDynamicEnumExtension) {

-        output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension.ToString());

+        output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension);

       }

       if (hasMessageExtension) {

         output.WriteMessage(2003, field_names[3], MessageExtension);

diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs
index aac362d..e6887dc 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs
@@ -977,7 +977,7 @@
     

     public const int NumberFieldNumber = 6;

     private bool hasNumber;

-    private long number_ = 0L;

+    private long number_;

     public bool HasNumber {

       get { return hasNumber; }

     }

@@ -1021,7 +1021,7 @@
     

     public const int ValidFieldNumber = 5;

     private bool hasValid;

-    private bool valid_ = false;

+    private bool valid_;

     public bool HasValid {

       get { return hasValid; }

     }

@@ -1549,7 +1549,7 @@
     

     public const int NumberFieldNumber = 1;

     private bool hasNumber;

-    private int number_ = 0;

+    private int number_;

     public bool HasNumber {

       get { return hasNumber; }

     }

diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs
index 1fea734..aad47f9 100644
--- a/src/ProtocolBuffers/CodedInputStream.cs
+++ b/src/ProtocolBuffers/CodedInputStream.cs
@@ -516,8 +516,13 @@
         /// <summary>

         /// Returns true if the next tag is also part of the same unpacked array

         /// </summary>

-        private bool ContinueArray(uint currentTag)

+        private bool ContinueArray(uint currentTag, bool packed)

         {

+            if (packed)

+            {

+                return !ReachedLimit;

+            }

+

             string ignore;

             uint next;

             if (PeekNextTag(out next, out ignore))

@@ -532,7 +537,7 @@
         }

 

         [CLSCompliant(false)]

-        public void ReadPrimitiveArray<T>(FieldType fieldType, uint fieldTag, string fieldName, ICollection<T> list)

+        public void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection<object> list)

         {

             WireFormat.WireType normal = WireFormat.GetWireType(fieldType);

             WireFormat.WireType wformat = WireFormat.GetTagWireType(fieldTag);

@@ -546,7 +551,7 @@
                 {

                     Object value = null;

                     if(ReadPrimitiveField(fieldType, ref value))

-                        list.Add((T)value);

+                        list.Add(value);

                 }

                 PopLimit(limit);

             }

@@ -556,9 +561,241 @@
                 do

                 {

                     if (ReadPrimitiveField(fieldType, ref value))

-                        list.Add((T)value);

+                        list.Add(value);

                 }

-                while (ContinueArray(fieldTag));

+                while (ContinueArray(fieldTag, false));

+            }

+        }

+

+        [CLSCompliant(false)]

+        public void ReadPrimitiveArray<T>(FieldType fieldType, uint fieldTag, string fieldName, ICollection<T> list)

+        {

+            WireFormat.WireType normal = WireFormat.GetWireType(fieldType);

+            WireFormat.WireType wformat = WireFormat.GetTagWireType(fieldTag);

+

+            // 2.3 allows packed form even if the field is not declared packed.

+            if (normal != wformat && wformat == WireFormat.WireType.LengthDelimited)

+            {

+                int length = (int)(ReadRawVarint32() & int.MaxValue);

+                int limit = PushLimit(length);

+                //while (!ReachedLimit)

+                //{

+                //    Object value = null;

+                //    if (ReadPrimitiveField(fieldType, ref value))

+                //        list.Add((T)value);

+                //}

+                if (!ReachedLimit)

+                    ReadPrimitiveArrayItems(fieldType, fieldTag, list, true);

+

+                PopLimit(limit);

+            }

+            else

+            {

+                ReadPrimitiveArrayItems(fieldType, fieldTag, list, false);

+                //Object value = null;

+                //do

+                //{

+                //    if (ReadPrimitiveField(fieldType, ref value))

+                //        list.Add((T)value);

+                //}

+                //while (ContinueArray(fieldTag, false));

+            }

+        }

+

+        void ReadPrimitiveArrayItems<T>(FieldType fieldType, uint fieldTag, ICollection<T> list, bool packed)

+        {

+            switch (fieldType)

+            {

+                case FieldType.Double:

+                    {

+                        ICollection<double> output = (ICollection<double>)list;

+                        double tmp = 0;

+                        do

+                        {

+                            ReadDouble(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Float:

+                    {

+                        ICollection<float> output = (ICollection<float>)list;

+                        float tmp = 0;

+                        do

+                        {

+                            ReadFloat(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Int64:

+                    {

+                        ICollection<long> output = (ICollection<long>)list;

+                        long tmp = 0;

+                        do

+                        {

+                            ReadInt64(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.UInt64:

+                    {

+                        ICollection<ulong> output = (ICollection<ulong>)list;

+                        ulong tmp = 0;

+                        do

+                        {

+                            ReadUInt64(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Int32:

+                    {

+                        ICollection<int> output = (ICollection<int>)list;

+                        int tmp = 0;

+                        do

+                        {

+                            ReadInt32(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Fixed64:

+                    {

+                        ICollection<ulong> output = (ICollection<ulong>)list;

+                        ulong tmp = 0;

+                        do

+                        {

+                            ReadFixed64(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Fixed32:

+                    {

+                        ICollection<uint> output = (ICollection<uint>)list;

+                        uint tmp = 0;

+                        do

+                        {

+                            ReadFixed32(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Bool:

+                    {

+                        ICollection<bool> output = (ICollection<bool>)list;

+                        bool tmp = false;

+                        do

+                        {

+                            ReadBool(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.String:

+                    {

+                        ICollection<string> output = (ICollection<string>)list;

+                        string tmp = null;

+                        do

+                        {

+                            ReadString(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Bytes:

+                    {

+                        ICollection<ByteString> output = (ICollection<ByteString>)list;

+                        ByteString tmp = null;

+                        do

+                        {

+                            ReadBytes(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.UInt32:

+                    {

+                        ICollection<uint> output = (ICollection<uint>)list;

+                        uint tmp = 0;

+                        do

+                        {

+                            ReadUInt32(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.SFixed32:

+                    {

+                        ICollection<int> output = (ICollection<int>)list;

+                        int tmp = 0;

+                        do

+                        {

+                            ReadSFixed32(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.SFixed64:

+                    {

+                        ICollection<long> output = (ICollection<long>)list;

+                        long tmp = 0;

+                        do

+                        {

+                            ReadSFixed64(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.SInt32:

+                    {

+                        ICollection<int> output = (ICollection<int>)list;

+                        int tmp = 0;

+                        do

+                        {

+                            ReadSInt32(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.SInt64:

+                    {

+                        ICollection<long> output = (ICollection<long>)list;

+                        long tmp = 0;

+                        do

+                        {

+                            ReadSInt64(ref tmp);

+                            output.Add(tmp);

+                        }

+                        while (ContinueArray(fieldTag, packed));

+                    }

+                    break;

+                case FieldType.Group:

+                    throw new ArgumentException("ReadPrimitiveField() cannot handle nested groups.");

+                case FieldType.Message:

+                    throw new ArgumentException("ReadPrimitiveField() cannot handle embedded messages.");

+                // We don't handle enums because we don't know what to do if the

+                // value is not recognized.

+                case FieldType.Enum:

+                    throw new ArgumentException("ReadPrimitiveField() cannot handle enums.");

+                default:

+                    throw new ArgumentOutOfRangeException("Invalid field type " + fieldType);

             }

         }

 

@@ -601,7 +838,7 @@
                         unknown.Add(unkval);

                     }

                 }

-                while (ContinueArray(fieldTag));

+                while (ContinueArray(fieldTag, false));

             }

         }

 

@@ -645,7 +882,7 @@
                         unknown.Add(unkval);

                     }

                 }

-                while (ContinueArray(fieldTag));

+                while (ContinueArray(fieldTag, false));

             }

         }

 

@@ -658,7 +895,7 @@
                 ReadMessage(builder, registry);

                 list.Add((T)builder.WeakBuildPartial());

             }

-            while (ContinueArray(fieldTag));

+            while (ContinueArray(fieldTag, false));

         }

 

         [CLSCompliant(false)]

@@ -670,7 +907,7 @@
                 ReadGroup(WireFormat.GetTagFieldNumber(fieldTag), builder, registry);

                 list.Add((T)builder.WeakBuildPartial());

             }

-            while (ContinueArray(fieldTag));

+            while (ContinueArray(fieldTag, false));

         }

 

         /// <summary>

diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs
index 0bc4a46..3735541 100644
--- a/src/ProtocolBuffers/CodedOutputStream.cs
+++ b/src/ProtocolBuffers/CodedOutputStream.cs
@@ -40,6 +40,7 @@
 using System.IO;

 using System.Runtime.InteropServices;

 using System.Text;

+using Google.ProtocolBuffers.Collections;

 using Google.ProtocolBuffers.Descriptors;

 

 namespace Google.ProtocolBuffers

@@ -272,7 +273,7 @@
             WriteRawVarint32(value);

         }

 

-        public void WriteEnum(int fieldNumber, string fieldName, int value, string textValue)

+        public void WriteEnum(int fieldNumber, string fieldName, int value, object textValue)

         {

             WriteTag(fieldNumber, WireFormat.WireType.Varint);

             WriteRawVarint32((uint) value);

@@ -349,11 +350,14 @@
                         WriteBool(fieldNumber, fieldName, value);

                     break;

                 case FieldType.Enum:

-                    foreach (T value in list)

+                    if (default(T) is System.Enum)

                     {

-                        if (value is System.Enum)

-                            WriteEnum(fieldNumber, fieldName, ((IConvertible)value).ToInt32(CultureInfo.InvariantCulture), null/*not used*/);

-                        else

+                        foreach (int value in ((ICastArray)list).CastArray<int>())

+                            WriteEnum(fieldNumber, fieldName, value, null/*not used*/);

+                    }

+                    else

+                    {

+                        foreach (T value in list)

                             WriteEnum(fieldNumber, fieldName, ((IEnumLite)value).Number, null/*not used*/);

                     }

                     break;

@@ -449,11 +453,14 @@
                         WriteBoolNoTag(value);

                     break;

                 case FieldType.Enum:

-                    foreach (T value in list)

+                    if (default(T) is System.Enum)

                     {

-                        if (value is System.Enum)

-                            WriteEnumNoTag(((IConvertible)value).ToInt32(CultureInfo.InvariantCulture));

-                        else

+                        foreach (int value in ((ICastArray)list).CastArray<int>())

+                            WriteEnumNoTag(value);

+                    }

+                    else

+                    {

+                        foreach (T value in list)

                             WriteEnumNoTag(((IEnumLite)value).Number);

                     }

                     break;

@@ -529,7 +536,7 @@
                     break;

                 case FieldType.Enum:

                     if (value is System.Enum)

-                        WriteEnum(fieldNumber, fieldName, ((IConvertible)value).ToInt32(CultureInfo.InvariantCulture), null/*not used*/);

+                        WriteEnum(fieldNumber, fieldName, (int)value, null/*not used*/);

                     else

                         WriteEnum(fieldNumber, fieldName, ((IEnumLite)value).Number, null/*not used*/);

                     break;

@@ -593,7 +600,7 @@
                     break;

                 case FieldType.Enum:

                     if (value is System.Enum)

-                        WriteEnumNoTag(((IConvertible)value).ToInt32(CultureInfo.InvariantCulture));

+                        WriteEnumNoTag((int)value);

                     else

                         WriteEnumNoTag(((IEnumLite)value).Number);

                     break;

diff --git a/src/ProtocolBuffers/Collections/IPopsicleList.cs b/src/ProtocolBuffers/Collections/IPopsicleList.cs
index 7f6fd8b..a1a7581 100644
--- a/src/ProtocolBuffers/Collections/IPopsicleList.cs
+++ b/src/ProtocolBuffers/Collections/IPopsicleList.cs
@@ -47,4 +47,12 @@
     {

         void Add(IEnumerable<T> collection);

     }

+

+    /// <summary>

+    /// Used to efficiently cast the elements of enumerations

+    /// </summary>

+    internal interface ICastArray

+    {

+        IEnumerable<TItemType> CastArray<TItemType>();

+    }

 }
\ No newline at end of file
diff --git a/src/ProtocolBuffers/Collections/PopsicleList.cs b/src/ProtocolBuffers/Collections/PopsicleList.cs
index 3332430..48161e8 100644
--- a/src/ProtocolBuffers/Collections/PopsicleList.cs
+++ b/src/ProtocolBuffers/Collections/PopsicleList.cs
@@ -40,10 +40,12 @@
     /// to be made read-only (with the <see cref="MakeReadOnly" /> method), 

     /// after which any modifying methods throw <see cref="NotSupportedException" />.

     /// </summary>

-    public sealed class PopsicleList<T> : IPopsicleList<T>

+    public sealed class PopsicleList<T> : IPopsicleList<T>, ICastArray

     {

-        private readonly List<T> items = new List<T>();

-        private bool readOnly = false;

+        private static readonly IEnumerable<T> EmptySet = new T[0];

+

+        private List<T> items;

+        private bool readOnly;

 

         /// <summary>

         /// Makes this list read-only ("freezes the popsicle"). From this

@@ -57,7 +59,7 @@
 

         public int IndexOf(T item)

         {

-            return items.IndexOf(item);

+            return items == null ? -1 : items.IndexOf(item);

         }

 

         public void Insert(int index, T item)

@@ -74,7 +76,7 @@
 

         public T this[int index]

         {

-            get { return items[index]; }

+            get { if (items == null) throw new ArgumentOutOfRangeException(); return items[index]; }

             set

             {

                 ValidateModification();

@@ -96,17 +98,18 @@
 

         public bool Contains(T item)

         {

-            return items.Contains(item);

+            return items == null ? false : items.Contains(item);

         }

 

         public void CopyTo(T[] array, int arrayIndex)

         {

-            items.CopyTo(array, arrayIndex);

+            if (items != null)

+                items.CopyTo(array, arrayIndex);

         }

 

         public int Count

         {

-            get { return items.Count; }

+            get { return items == null ? 0 : items.Count; }

         }

 

         public bool IsReadOnly

@@ -120,31 +123,42 @@
             return items.Remove(item);

         }

 

+        public IEnumerator<T> GetEnumerator()

+        {

+            return items == null ? EmptySet.GetEnumerator() : items.GetEnumerator();

+        }

+

+        IEnumerator IEnumerable.GetEnumerator()

+        {

+            return GetEnumerator();

+        }

+

         public void Add(IEnumerable<T> collection)

         {

             if (readOnly)

             {

                 throw new NotSupportedException("List is read-only");

             }

+            if (items == null)

+                items = new List<T>();

             items.AddRange(collection);

         }

 

-        public IEnumerator<T> GetEnumerator()

-        {

-            return items.GetEnumerator();

-        }

-

-        IEnumerator IEnumerable.GetEnumerator()

-        {

-            return GetEnumerator();

-        }

-

         private void ValidateModification()

         {

             if (readOnly)

             {

                 throw new NotSupportedException("List is read-only");

             }

+            if (items == null)

+                items = new List<T>();

+        }

+

+        IEnumerable<TItemType> ICastArray.CastArray<TItemType>()

+        {

+            if (items == null)

+                return new TItemType[0];

+            return (TItemType[])(object)items.ToArray();

         }

     }

 }
\ No newline at end of file
diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
index 8bcbde7..e330806 100644
--- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
@@ -178,7 +178,7 @@
     

     public const int MultipleFilesFieldNumber = 4;

     private bool hasMultipleFiles;

-    private bool multipleFiles_ = false;

+    private bool multipleFiles_;

     public bool HasMultipleFiles {

       get { return hasMultipleFiles; }

     }

@@ -188,7 +188,7 @@
     

     public const int NestClassesFieldNumber = 5;

     private bool hasNestClasses;

-    private bool nestClasses_ = false;

+    private bool nestClasses_;

     public bool HasNestClasses {

       get { return hasNestClasses; }

     }

@@ -198,7 +198,7 @@
     

     public const int CodeContractsFieldNumber = 6;

     private bool hasCodeContracts;

-    private bool codeContracts_ = false;

+    private bool codeContracts_;

     public bool HasCodeContracts {

       get { return hasCodeContracts; }

     }

@@ -208,7 +208,7 @@
     

     public const int ExpandNamespaceDirectoriesFieldNumber = 7;

     private bool hasExpandNamespaceDirectories;

-    private bool expandNamespaceDirectories_ = false;

+    private bool expandNamespaceDirectories_;

     public bool HasExpandNamespaceDirectories {

       get { return hasExpandNamespaceDirectories; }

     }

@@ -258,7 +258,7 @@
     

     public const int IgnoreGoogleProtobufFieldNumber = 224;

     private bool hasIgnoreGoogleProtobuf;

-    private bool ignoreGoogleProtobuf_ = false;

+    private bool ignoreGoogleProtobuf_;

     public bool HasIgnoreGoogleProtobuf {

       get { return hasIgnoreGoogleProtobuf; }

     }

@@ -322,7 +322,7 @@
         output.WriteBool(224, field_names[4], IgnoreGoogleProtobuf);

       }

       if (hasServiceGeneratorType) {

-        output.WriteEnum(225, field_names[10], (int) ServiceGeneratorType, ServiceGeneratorType.ToString());

+        output.WriteEnum(225, field_names[10], (int) ServiceGeneratorType, ServiceGeneratorType);

       }

       UnknownFields.WriteTo(output);

     }

@@ -1372,7 +1372,7 @@
     

     public const int DispatchIdFieldNumber = 1;

     private bool hasDispatchId;

-    private int dispatchId_ = 0;

+    private int dispatchId_;

     public bool HasDispatchId {

       get { return hasDispatchId; }

     }

diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
index 4507f3f..ee6ac94 100644
--- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
+++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
@@ -1229,7 +1229,7 @@
         

         public const int StartFieldNumber = 1;

         private bool hasStart;

-        private int start_ = 0;

+        private int start_;

         public bool HasStart {

           get { return hasStart; }

         }

@@ -1239,7 +1239,7 @@
         

         public const int EndFieldNumber = 2;

         private bool hasEnd;

-        private int end_ = 0;

+        private int end_;

         public bool HasEnd {

           get { return hasEnd; }

         }

@@ -2173,7 +2173,7 @@
     

     public const int NumberFieldNumber = 3;

     private bool hasNumber;

-    private int number_ = 0;

+    private int number_;

     public bool HasNumber {

       get { return hasNumber; }

     }

@@ -2263,10 +2263,10 @@
         output.WriteInt32(3, field_names[4], Number);

       }

       if (hasLabel) {

-        output.WriteEnum(4, field_names[2], (int) Label, Label.ToString());

+        output.WriteEnum(4, field_names[2], (int) Label, Label);

       }

       if (hasType) {

-        output.WriteEnum(5, field_names[6], (int) Type, Type.ToString());

+        output.WriteEnum(5, field_names[6], (int) Type, Type);

       }

       if (hasTypeName) {

         output.WriteString(6, field_names[7], TypeName);

@@ -3119,7 +3119,7 @@
     

     public const int NumberFieldNumber = 2;

     private bool hasNumber;

-    private int number_ = 0;

+    private int number_;

     public bool HasNumber {

       get { return hasNumber; }

     }

@@ -4258,7 +4258,7 @@
     

     public const int JavaMultipleFilesFieldNumber = 10;

     private bool hasJavaMultipleFiles;

-    private bool javaMultipleFiles_ = false;

+    private bool javaMultipleFiles_;

     public bool HasJavaMultipleFiles {

       get { return hasJavaMultipleFiles; }

     }

@@ -4339,7 +4339,7 @@
         output.WriteString(8, field_names[3], JavaOuterClassname);

       }

       if (hasOptimizeFor) {

-        output.WriteEnum(9, field_names[5], (int) OptimizeFor, OptimizeFor.ToString());

+        output.WriteEnum(9, field_names[5], (int) OptimizeFor, OptimizeFor);

       }

       if (hasJavaMultipleFiles) {

         output.WriteBool(10, field_names[2], JavaMultipleFiles);

@@ -4805,7 +4805,7 @@
     

     public const int MessageSetWireFormatFieldNumber = 1;

     private bool hasMessageSetWireFormat;

-    private bool messageSetWireFormat_ = false;

+    private bool messageSetWireFormat_;

     public bool HasMessageSetWireFormat {

       get { return hasMessageSetWireFormat; }

     }

@@ -4815,7 +4815,7 @@
     

     public const int NoStandardDescriptorAccessorFieldNumber = 2;

     private bool hasNoStandardDescriptorAccessor;

-    private bool noStandardDescriptorAccessor_ = false;

+    private bool noStandardDescriptorAccessor_;

     public bool HasNoStandardDescriptorAccessor {

       get { return hasNoStandardDescriptorAccessor; }

     }

@@ -5183,7 +5183,7 @@
     

     public const int PackedFieldNumber = 2;

     private bool hasPacked;

-    private bool packed_ = false;

+    private bool packed_;

     public bool HasPacked {

       get { return hasPacked; }

     }

@@ -5193,7 +5193,7 @@
     

     public const int DeprecatedFieldNumber = 3;

     private bool hasDeprecated;

-    private bool deprecated_ = false;

+    private bool deprecated_;

     public bool HasDeprecated {

       get { return hasDeprecated; }

     }

@@ -5238,7 +5238,7 @@
       string[] field_names = _fieldOptionsFieldNames;

       pb::ExtendableMessage<FieldOptions, FieldOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);

       if (hasCtype) {

-        output.WriteEnum(1, field_names[0], (int) Ctype, Ctype.ToString());

+        output.WriteEnum(1, field_names[0], (int) Ctype, Ctype);

       }

       if (hasPacked) {

         output.WriteBool(2, field_names[3], Packed);

@@ -6738,7 +6738,7 @@
         

         public const int IsExtensionFieldNumber = 2;

         private bool hasIsExtension;

-        private bool isExtension_ = false;

+        private bool isExtension_;

         public bool HasIsExtension {

           get { return hasIsExtension; }

         }

@@ -7009,7 +7009,7 @@
     

     public const int PositiveIntValueFieldNumber = 4;

     private bool hasPositiveIntValue;

-    private ulong positiveIntValue_ = 0UL;

+    private ulong positiveIntValue_;

     public bool HasPositiveIntValue {

       get { return hasPositiveIntValue; }

     }

@@ -7020,7 +7020,7 @@
     

     public const int NegativeIntValueFieldNumber = 5;

     private bool hasNegativeIntValue;

-    private long negativeIntValue_ = 0L;

+    private long negativeIntValue_;

     public bool HasNegativeIntValue {

       get { return hasNegativeIntValue; }

     }

@@ -7030,7 +7030,7 @@
     

     public const int DoubleValueFieldNumber = 6;

     private bool hasDoubleValue;

-    private double doubleValue_ = 0D;

+    private double doubleValue_;

     public bool HasDoubleValue {

       get { return hasDoubleValue; }

     }

diff --git a/src/ProtocolBuffers/ICodedInputStream.cs b/src/ProtocolBuffers/ICodedInputStream.cs
index f385454..f4c6622 100644
--- a/src/ProtocolBuffers/ICodedInputStream.cs
+++ b/src/ProtocolBuffers/ICodedInputStream.cs
@@ -144,6 +144,13 @@
         /// type is numberic, it will read a packed array.

         /// </summary>

         [CLSCompliant(false)]

+        void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection<object> list);

+

+        /// <summary>

+        /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed and the 

+        /// type is numberic, it will read a packed array.

+        /// </summary>

+        [CLSCompliant(false)]

         void ReadPrimitiveArray<T>(FieldType fieldType, uint fieldTag, string fieldName, ICollection<T> list);

 

         /// <summary>

diff --git a/src/ProtocolBuffers/ICodedOutputStream.cs b/src/ProtocolBuffers/ICodedOutputStream.cs
index db7ea6e..6408d98 100644
--- a/src/ProtocolBuffers/ICodedOutputStream.cs
+++ b/src/ProtocolBuffers/ICodedOutputStream.cs
@@ -70,7 +70,7 @@
         [CLSCompliant(false)]

         void WriteUInt32(int fieldNumber, string fieldName, uint value);

 

-        void WriteEnum(int fieldNumber, string fieldName, int value, string textValue);

+        void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue);

         void WriteSFixed32(int fieldNumber, string fieldName, int value);

         void WriteSFixed64(int fieldNumber, string fieldName, long value);

         void WriteSInt32(int fieldNumber, string fieldName, int value);

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
index 5f9e3b5..8eb2dfb 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
@@ -393,7 +393,7 @@
         

         public const int ZipFieldNumber = 5;

         private bool hasZip;

-        private uint zip_ = 0;

+        private uint zip_;

         public bool HasZip {

           get { return hasZip; }

         }

@@ -597,7 +597,7 @@
     

     public const int IdFieldNumber = 2;

     private bool hasId;

-    private int id_ = 0;

+    private int id_;

     public bool HasId {

       get { return hasId; }

     }

@@ -1091,7 +1091,7 @@
         

         public const int CountFieldNumber = 5;

         private bool hasCount;

-        private int count_ = 0;

+        private int count_;

         public bool HasCount {

           get { return hasCount; }

         }

@@ -1257,7 +1257,7 @@
     

     public const int IdFieldNumber = 2;

     private bool hasId;

-    private int id_ = 0;

+    private int id_;

     public bool HasId {

       get { return hasId; }

     }

@@ -1656,7 +1656,7 @@
     

     public const int IdFieldNumber = 2;

     private bool hasId;

-    private int id_ = 0;

+    private int id_;

     public bool HasId {

       get { return hasId; }

     }

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
index 10900aa..e8f9dea 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
@@ -74,7 +74,7 @@
     

     public const int DFieldNumber = 1;

     private bool hasD;

-    private int d_ = 0;

+    private int d_;

     public bool HasD {

       get { return hasD; }

     }

@@ -107,7 +107,7 @@
         output.WriteInt32(1, field_names[0], D);

       }

       if (hasEn) {

-        output.WriteEnum(2, field_names[1], (int) En, En.ToString());

+        output.WriteEnum(2, field_names[1], (int) En, En);

       }

     }

     

@@ -418,7 +418,7 @@
             output.WriteString(1, field_names[0], Number);

           }

           if (hasType) {

-            output.WriteEnum(2, field_names[1], (int) Type, Type.ToString());

+            output.WriteEnum(2, field_names[1], (int) Type, Type);

           }

         }

         

@@ -706,7 +706,7 @@
         

         public const int ZipFieldNumber = 5;

         private bool hasZip;

-        private uint zip_ = 0;

+        private uint zip_;

         public bool HasZip {

           get { return hasZip; }

         }

@@ -1077,7 +1077,7 @@
     

     public const int IdFieldNumber = 2;

     private bool hasId;

-    private int id_ = 0;

+    private int id_;

     public bool HasId {

       get { return hasId; }

     }

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
index dc4ea54..3b869a3 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
@@ -58,7 +58,7 @@
     

     public const int DFieldNumber = 1;

     private bool hasD;

-    private int d_ = 0;

+    private int d_;

     public bool HasD {

       get { return hasD; }

     }

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
index adf6fd1..0f5bf32 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
@@ -94,7 +94,7 @@
     

     public const int DFieldNumber = 1;

     private bool hasD;

-    private int d_ = 0;

+    private int d_;

     public bool HasD {

       get { return hasD; }

     }

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
index e9c4c60..50ea783 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
@@ -1275,7 +1275,7 @@
         

         public const int BbFieldNumber = 1;

         private bool hasBb;

-        private int bb_ = 0;

+        private int bb_;

         public bool HasBb {

           get { return hasBb; }

         }

@@ -1505,7 +1505,7 @@
         

         public const int AFieldNumber = 17;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1735,7 +1735,7 @@
         

         public const int AFieldNumber = 47;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1949,7 +1949,7 @@
     

     public const int OptionalInt32FieldNumber = 1;

     private bool hasOptionalInt32;

-    private int optionalInt32_ = 0;

+    private int optionalInt32_;

     public bool HasOptionalInt32 {

       get { return hasOptionalInt32; }

     }

@@ -1959,7 +1959,7 @@
     

     public const int OptionalInt64FieldNumber = 2;

     private bool hasOptionalInt64;

-    private long optionalInt64_ = 0L;

+    private long optionalInt64_;

     public bool HasOptionalInt64 {

       get { return hasOptionalInt64; }

     }

@@ -1969,7 +1969,7 @@
     

     public const int OptionalUint32FieldNumber = 3;

     private bool hasOptionalUint32;

-    private uint optionalUint32_ = 0;

+    private uint optionalUint32_;

     public bool HasOptionalUint32 {

       get { return hasOptionalUint32; }

     }

@@ -1980,7 +1980,7 @@
     

     public const int OptionalUint64FieldNumber = 4;

     private bool hasOptionalUint64;

-    private ulong optionalUint64_ = 0UL;

+    private ulong optionalUint64_;

     public bool HasOptionalUint64 {

       get { return hasOptionalUint64; }

     }

@@ -1991,7 +1991,7 @@
     

     public const int OptionalSint32FieldNumber = 5;

     private bool hasOptionalSint32;

-    private int optionalSint32_ = 0;

+    private int optionalSint32_;

     public bool HasOptionalSint32 {

       get { return hasOptionalSint32; }

     }

@@ -2001,7 +2001,7 @@
     

     public const int OptionalSint64FieldNumber = 6;

     private bool hasOptionalSint64;

-    private long optionalSint64_ = 0;

+    private long optionalSint64_;

     public bool HasOptionalSint64 {

       get { return hasOptionalSint64; }

     }

@@ -2011,7 +2011,7 @@
     

     public const int OptionalFixed32FieldNumber = 7;

     private bool hasOptionalFixed32;

-    private uint optionalFixed32_ = 0;

+    private uint optionalFixed32_;

     public bool HasOptionalFixed32 {

       get { return hasOptionalFixed32; }

     }

@@ -2022,7 +2022,7 @@
     

     public const int OptionalFixed64FieldNumber = 8;

     private bool hasOptionalFixed64;

-    private ulong optionalFixed64_ = 0;

+    private ulong optionalFixed64_;

     public bool HasOptionalFixed64 {

       get { return hasOptionalFixed64; }

     }

@@ -2033,7 +2033,7 @@
     

     public const int OptionalSfixed32FieldNumber = 9;

     private bool hasOptionalSfixed32;

-    private int optionalSfixed32_ = 0;

+    private int optionalSfixed32_;

     public bool HasOptionalSfixed32 {

       get { return hasOptionalSfixed32; }

     }

@@ -2043,7 +2043,7 @@
     

     public const int OptionalSfixed64FieldNumber = 10;

     private bool hasOptionalSfixed64;

-    private long optionalSfixed64_ = 0;

+    private long optionalSfixed64_;

     public bool HasOptionalSfixed64 {

       get { return hasOptionalSfixed64; }

     }

@@ -2053,7 +2053,7 @@
     

     public const int OptionalFloatFieldNumber = 11;

     private bool hasOptionalFloat;

-    private float optionalFloat_ = 0F;

+    private float optionalFloat_;

     public bool HasOptionalFloat {

       get { return hasOptionalFloat; }

     }

@@ -2063,7 +2063,7 @@
     

     public const int OptionalDoubleFieldNumber = 12;

     private bool hasOptionalDouble;

-    private double optionalDouble_ = 0D;

+    private double optionalDouble_;

     public bool HasOptionalDouble {

       get { return hasOptionalDouble; }

     }

@@ -2073,7 +2073,7 @@
     

     public const int OptionalBoolFieldNumber = 13;

     private bool hasOptionalBool;

-    private bool optionalBool_ = false;

+    private bool optionalBool_;

     public bool HasOptionalBool {

       get { return hasOptionalBool; }

     }

@@ -2758,13 +2758,13 @@
         output.WriteMessage(20, field_names[30], OptionalImportMessage);

       }

       if (hasOptionalNestedEnum) {

-        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum.ToString());

+        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum);

       }

       if (hasOptionalForeignEnum) {

-        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum.ToString());

+        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum);

       }

       if (hasOptionalImportEnum) {

-        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum.ToString());

+        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum);

       }

       if (hasOptionalStringPiece) {

         output.WriteString(24, field_names[40], OptionalStringPiece);

@@ -2890,13 +2890,13 @@
         output.WriteBytes(75, field_names[1], DefaultBytes);

       }

       if (hasDefaultNestedEnum) {

-        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum.ToString());

+        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum);

       }

       if (hasDefaultForeignEnum) {

-        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum.ToString());

+        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum);

       }

       if (hasDefaultImportEnum) {

-        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum.ToString());

+        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum);

       }

       if (hasDefaultStringPiece) {

         output.WriteString(84, field_names[17], DefaultStringPiece);

@@ -5806,7 +5806,7 @@
     

     public const int CFieldNumber = 1;

     private bool hasC;

-    private int c_ = 0;

+    private int c_;

     public bool HasC {

       get { return hasC; }

     }

@@ -8483,7 +8483,7 @@
     

     public const int AFieldNumber = 17;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -8713,7 +8713,7 @@
     

     public const int AFieldNumber = 47;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -9519,7 +9519,7 @@
     

     public const int DeprecatedFieldFieldNumber = 1;

     private bool hasDeprecatedField;

-    private int deprecatedField_ = 0;

+    private int deprecatedField_;

     public bool HasDeprecatedField {

       get { return hasDeprecatedField; }

     }

diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
index bf7d0da..a3294ca 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
@@ -1185,7 +1185,7 @@
         

         public const int BbFieldNumber = 1;

         private bool hasBb;

-        private int bb_ = 0;

+        private int bb_;

         public bool HasBb {

           get { return hasBb; }

         }

@@ -1424,7 +1424,7 @@
         

         public const int AFieldNumber = 17;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1663,7 +1663,7 @@
         

         public const int AFieldNumber = 47;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -1878,7 +1878,7 @@
     

     public const int OptionalInt32FieldNumber = 1;

     private bool hasOptionalInt32;

-    private int optionalInt32_ = 0;

+    private int optionalInt32_;

     public bool HasOptionalInt32 {

       get { return hasOptionalInt32; }

     }

@@ -1888,7 +1888,7 @@
     

     public const int OptionalInt64FieldNumber = 2;

     private bool hasOptionalInt64;

-    private long optionalInt64_ = 0L;

+    private long optionalInt64_;

     public bool HasOptionalInt64 {

       get { return hasOptionalInt64; }

     }

@@ -1898,7 +1898,7 @@
     

     public const int OptionalUint32FieldNumber = 3;

     private bool hasOptionalUint32;

-    private uint optionalUint32_ = 0;

+    private uint optionalUint32_;

     public bool HasOptionalUint32 {

       get { return hasOptionalUint32; }

     }

@@ -1909,7 +1909,7 @@
     

     public const int OptionalUint64FieldNumber = 4;

     private bool hasOptionalUint64;

-    private ulong optionalUint64_ = 0UL;

+    private ulong optionalUint64_;

     public bool HasOptionalUint64 {

       get { return hasOptionalUint64; }

     }

@@ -1920,7 +1920,7 @@
     

     public const int OptionalSint32FieldNumber = 5;

     private bool hasOptionalSint32;

-    private int optionalSint32_ = 0;

+    private int optionalSint32_;

     public bool HasOptionalSint32 {

       get { return hasOptionalSint32; }

     }

@@ -1930,7 +1930,7 @@
     

     public const int OptionalSint64FieldNumber = 6;

     private bool hasOptionalSint64;

-    private long optionalSint64_ = 0;

+    private long optionalSint64_;

     public bool HasOptionalSint64 {

       get { return hasOptionalSint64; }

     }

@@ -1940,7 +1940,7 @@
     

     public const int OptionalFixed32FieldNumber = 7;

     private bool hasOptionalFixed32;

-    private uint optionalFixed32_ = 0;

+    private uint optionalFixed32_;

     public bool HasOptionalFixed32 {

       get { return hasOptionalFixed32; }

     }

@@ -1951,7 +1951,7 @@
     

     public const int OptionalFixed64FieldNumber = 8;

     private bool hasOptionalFixed64;

-    private ulong optionalFixed64_ = 0;

+    private ulong optionalFixed64_;

     public bool HasOptionalFixed64 {

       get { return hasOptionalFixed64; }

     }

@@ -1962,7 +1962,7 @@
     

     public const int OptionalSfixed32FieldNumber = 9;

     private bool hasOptionalSfixed32;

-    private int optionalSfixed32_ = 0;

+    private int optionalSfixed32_;

     public bool HasOptionalSfixed32 {

       get { return hasOptionalSfixed32; }

     }

@@ -1972,7 +1972,7 @@
     

     public const int OptionalSfixed64FieldNumber = 10;

     private bool hasOptionalSfixed64;

-    private long optionalSfixed64_ = 0;

+    private long optionalSfixed64_;

     public bool HasOptionalSfixed64 {

       get { return hasOptionalSfixed64; }

     }

@@ -1982,7 +1982,7 @@
     

     public const int OptionalFloatFieldNumber = 11;

     private bool hasOptionalFloat;

-    private float optionalFloat_ = 0F;

+    private float optionalFloat_;

     public bool HasOptionalFloat {

       get { return hasOptionalFloat; }

     }

@@ -1992,7 +1992,7 @@
     

     public const int OptionalDoubleFieldNumber = 12;

     private bool hasOptionalDouble;

-    private double optionalDouble_ = 0D;

+    private double optionalDouble_;

     public bool HasOptionalDouble {

       get { return hasOptionalDouble; }

     }

@@ -2002,7 +2002,7 @@
     

     public const int OptionalBoolFieldNumber = 13;

     private bool hasOptionalBool;

-    private bool optionalBool_ = false;

+    private bool optionalBool_;

     public bool HasOptionalBool {

       get { return hasOptionalBool; }

     }

@@ -2687,13 +2687,13 @@
         output.WriteMessage(20, field_names[30], OptionalImportMessage);

       }

       if (hasOptionalNestedEnum) {

-        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum.ToString());

+        output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum);

       }

       if (hasOptionalForeignEnum) {

-        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum.ToString());

+        output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum);

       }

       if (hasOptionalImportEnum) {

-        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum.ToString());

+        output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum);

       }

       if (hasOptionalStringPiece) {

         output.WriteString(24, field_names[40], OptionalStringPiece);

@@ -2819,13 +2819,13 @@
         output.WriteBytes(75, field_names[1], DefaultBytes);

       }

       if (hasDefaultNestedEnum) {

-        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum.ToString());

+        output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum);

       }

       if (hasDefaultForeignEnum) {

-        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum.ToString());

+        output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum);

       }

       if (hasDefaultImportEnum) {

-        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum.ToString());

+        output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum);

       }

       if (hasDefaultStringPiece) {

         output.WriteString(84, field_names[17], DefaultStringPiece);

@@ -5519,7 +5519,7 @@
     

     public const int DeprecatedInt32FieldNumber = 1;

     private bool hasDeprecatedInt32;

-    private int deprecatedInt32_ = 0;

+    private int deprecatedInt32_;

     public bool HasDeprecatedInt32 {

       get { return hasDeprecatedInt32; }

     }

@@ -5758,7 +5758,7 @@
     

     public const int CFieldNumber = 1;

     private bool hasC;

-    private int c_ = 0;

+    private int c_;

     public bool HasC {

       get { return hasC; }

     }

@@ -6200,7 +6200,7 @@
     

     public const int AFieldNumber = 17;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6439,7 +6439,7 @@
     

     public const int AFieldNumber = 47;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6882,7 +6882,7 @@
     public static pb::GeneratedExtensionBase<scg::IList<global::Google.ProtocolBuffers.TestProtos.TestRequired>> Multi;

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -6892,7 +6892,7 @@
     

     public const int Dummy2FieldNumber = 2;

     private bool hasDummy2;

-    private int dummy2_ = 0;

+    private int dummy2_;

     public bool HasDummy2 {

       get { return hasDummy2; }

     }

@@ -6902,7 +6902,7 @@
     

     public const int BFieldNumber = 3;

     private bool hasB;

-    private int b_ = 0;

+    private int b_;

     public bool HasB {

       get { return hasB; }

     }

@@ -6912,7 +6912,7 @@
     

     public const int Dummy4FieldNumber = 4;

     private bool hasDummy4;

-    private int dummy4_ = 0;

+    private int dummy4_;

     public bool HasDummy4 {

       get { return hasDummy4; }

     }

@@ -6922,7 +6922,7 @@
     

     public const int Dummy5FieldNumber = 5;

     private bool hasDummy5;

-    private int dummy5_ = 0;

+    private int dummy5_;

     public bool HasDummy5 {

       get { return hasDummy5; }

     }

@@ -6932,7 +6932,7 @@
     

     public const int Dummy6FieldNumber = 6;

     private bool hasDummy6;

-    private int dummy6_ = 0;

+    private int dummy6_;

     public bool HasDummy6 {

       get { return hasDummy6; }

     }

@@ -6942,7 +6942,7 @@
     

     public const int Dummy7FieldNumber = 7;

     private bool hasDummy7;

-    private int dummy7_ = 0;

+    private int dummy7_;

     public bool HasDummy7 {

       get { return hasDummy7; }

     }

@@ -6952,7 +6952,7 @@
     

     public const int Dummy8FieldNumber = 8;

     private bool hasDummy8;

-    private int dummy8_ = 0;

+    private int dummy8_;

     public bool HasDummy8 {

       get { return hasDummy8; }

     }

@@ -6962,7 +6962,7 @@
     

     public const int Dummy9FieldNumber = 9;

     private bool hasDummy9;

-    private int dummy9_ = 0;

+    private int dummy9_;

     public bool HasDummy9 {

       get { return hasDummy9; }

     }

@@ -6972,7 +6972,7 @@
     

     public const int Dummy10FieldNumber = 10;

     private bool hasDummy10;

-    private int dummy10_ = 0;

+    private int dummy10_;

     public bool HasDummy10 {

       get { return hasDummy10; }

     }

@@ -6982,7 +6982,7 @@
     

     public const int Dummy11FieldNumber = 11;

     private bool hasDummy11;

-    private int dummy11_ = 0;

+    private int dummy11_;

     public bool HasDummy11 {

       get { return hasDummy11; }

     }

@@ -6992,7 +6992,7 @@
     

     public const int Dummy12FieldNumber = 12;

     private bool hasDummy12;

-    private int dummy12_ = 0;

+    private int dummy12_;

     public bool HasDummy12 {

       get { return hasDummy12; }

     }

@@ -7002,7 +7002,7 @@
     

     public const int Dummy13FieldNumber = 13;

     private bool hasDummy13;

-    private int dummy13_ = 0;

+    private int dummy13_;

     public bool HasDummy13 {

       get { return hasDummy13; }

     }

@@ -7012,7 +7012,7 @@
     

     public const int Dummy14FieldNumber = 14;

     private bool hasDummy14;

-    private int dummy14_ = 0;

+    private int dummy14_;

     public bool HasDummy14 {

       get { return hasDummy14; }

     }

@@ -7022,7 +7022,7 @@
     

     public const int Dummy15FieldNumber = 15;

     private bool hasDummy15;

-    private int dummy15_ = 0;

+    private int dummy15_;

     public bool HasDummy15 {

       get { return hasDummy15; }

     }

@@ -7032,7 +7032,7 @@
     

     public const int Dummy16FieldNumber = 16;

     private bool hasDummy16;

-    private int dummy16_ = 0;

+    private int dummy16_;

     public bool HasDummy16 {

       get { return hasDummy16; }

     }

@@ -7042,7 +7042,7 @@
     

     public const int Dummy17FieldNumber = 17;

     private bool hasDummy17;

-    private int dummy17_ = 0;

+    private int dummy17_;

     public bool HasDummy17 {

       get { return hasDummy17; }

     }

@@ -7052,7 +7052,7 @@
     

     public const int Dummy18FieldNumber = 18;

     private bool hasDummy18;

-    private int dummy18_ = 0;

+    private int dummy18_;

     public bool HasDummy18 {

       get { return hasDummy18; }

     }

@@ -7062,7 +7062,7 @@
     

     public const int Dummy19FieldNumber = 19;

     private bool hasDummy19;

-    private int dummy19_ = 0;

+    private int dummy19_;

     public bool HasDummy19 {

       get { return hasDummy19; }

     }

@@ -7072,7 +7072,7 @@
     

     public const int Dummy20FieldNumber = 20;

     private bool hasDummy20;

-    private int dummy20_ = 0;

+    private int dummy20_;

     public bool HasDummy20 {

       get { return hasDummy20; }

     }

@@ -7082,7 +7082,7 @@
     

     public const int Dummy21FieldNumber = 21;

     private bool hasDummy21;

-    private int dummy21_ = 0;

+    private int dummy21_;

     public bool HasDummy21 {

       get { return hasDummy21; }

     }

@@ -7092,7 +7092,7 @@
     

     public const int Dummy22FieldNumber = 22;

     private bool hasDummy22;

-    private int dummy22_ = 0;

+    private int dummy22_;

     public bool HasDummy22 {

       get { return hasDummy22; }

     }

@@ -7102,7 +7102,7 @@
     

     public const int Dummy23FieldNumber = 23;

     private bool hasDummy23;

-    private int dummy23_ = 0;

+    private int dummy23_;

     public bool HasDummy23 {

       get { return hasDummy23; }

     }

@@ -7112,7 +7112,7 @@
     

     public const int Dummy24FieldNumber = 24;

     private bool hasDummy24;

-    private int dummy24_ = 0;

+    private int dummy24_;

     public bool HasDummy24 {

       get { return hasDummy24; }

     }

@@ -7122,7 +7122,7 @@
     

     public const int Dummy25FieldNumber = 25;

     private bool hasDummy25;

-    private int dummy25_ = 0;

+    private int dummy25_;

     public bool HasDummy25 {

       get { return hasDummy25; }

     }

@@ -7132,7 +7132,7 @@
     

     public const int Dummy26FieldNumber = 26;

     private bool hasDummy26;

-    private int dummy26_ = 0;

+    private int dummy26_;

     public bool HasDummy26 {

       get { return hasDummy26; }

     }

@@ -7142,7 +7142,7 @@
     

     public const int Dummy27FieldNumber = 27;

     private bool hasDummy27;

-    private int dummy27_ = 0;

+    private int dummy27_;

     public bool HasDummy27 {

       get { return hasDummy27; }

     }

@@ -7152,7 +7152,7 @@
     

     public const int Dummy28FieldNumber = 28;

     private bool hasDummy28;

-    private int dummy28_ = 0;

+    private int dummy28_;

     public bool HasDummy28 {

       get { return hasDummy28; }

     }

@@ -7162,7 +7162,7 @@
     

     public const int Dummy29FieldNumber = 29;

     private bool hasDummy29;

-    private int dummy29_ = 0;

+    private int dummy29_;

     public bool HasDummy29 {

       get { return hasDummy29; }

     }

@@ -7172,7 +7172,7 @@
     

     public const int Dummy30FieldNumber = 30;

     private bool hasDummy30;

-    private int dummy30_ = 0;

+    private int dummy30_;

     public bool HasDummy30 {

       get { return hasDummy30; }

     }

@@ -7182,7 +7182,7 @@
     

     public const int Dummy31FieldNumber = 31;

     private bool hasDummy31;

-    private int dummy31_ = 0;

+    private int dummy31_;

     public bool HasDummy31 {

       get { return hasDummy31; }

     }

@@ -7192,7 +7192,7 @@
     

     public const int Dummy32FieldNumber = 32;

     private bool hasDummy32;

-    private int dummy32_ = 0;

+    private int dummy32_;

     public bool HasDummy32 {

       get { return hasDummy32; }

     }

@@ -7202,7 +7202,7 @@
     

     public const int CFieldNumber = 33;

     private bool hasC;

-    private int c_ = 0;

+    private int c_;

     public bool HasC {

       get { return hasC; }

     }

@@ -8458,7 +8458,7 @@
     

     public const int DummyFieldNumber = 3;

     private bool hasDummy;

-    private int dummy_ = 0;

+    private int dummy_;

     public bool HasDummy {

       get { return hasDummy; }

     }

@@ -9677,7 +9677,7 @@
     

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -9687,7 +9687,7 @@
     

     public const int BbFieldNumber = 268435455;

     private bool hasBb;

-    private int bb_ = 0;

+    private int bb_;

     public bool HasBb {

       get { return hasBb; }

     }

@@ -9967,7 +9967,7 @@
     

     public const int IFieldNumber = 2;

     private bool hasI;

-    private int i_ = 0;

+    private int i_;

     public bool HasI {

       get { return hasI; }

     }

@@ -10532,7 +10532,7 @@
     

     public const int OptionalInt32FieldNumber = 2;

     private bool hasOptionalInt32;

-    private int optionalInt32_ = 0;

+    private int optionalInt32_;

     public bool HasOptionalInt32 {

       get { return hasOptionalInt32; }

     }

@@ -10857,7 +10857,7 @@
         

         public const int AFieldNumber = 1;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -11096,7 +11096,7 @@
         

         public const int AFieldNumber = 1;

         private bool hasA;

-        private int a_ = 0;

+        private int a_;

         public bool HasA {

           get { return hasA; }

         }

@@ -11311,7 +11311,7 @@
     

     public const int AFieldNumber = 1;

     private bool hasA;

-    private int a_ = 0;

+    private int a_;

     public bool HasA {

       get { return hasA; }

     }

@@ -12268,7 +12268,7 @@
     

     public const int PrimitiveFieldFieldNumber = 1;

     private bool hasPrimitiveField;

-    private int primitiveField_ = 0;

+    private int primitiveField_;

     public bool HasPrimitiveField {

       get { return hasPrimitiveField; }

     }

@@ -12414,7 +12414,7 @@
         output.WriteString(2, field_names[10], StringField);

       }

       if (hasEnumField) {

-        output.WriteEnum(3, field_names[1], (int) EnumField, EnumField.ToString());

+        output.WriteEnum(3, field_names[1], (int) EnumField, EnumField);

       }

       if (hasMessageField) {

         output.WriteMessage(4, field_names[2], MessageField);

@@ -13124,7 +13124,7 @@
     

     public const int MyIntFieldNumber = 1;

     private bool hasMyInt;

-    private long myInt_ = 0L;

+    private long myInt_;

     public bool HasMyInt {

       get { return hasMyInt; }

     }

@@ -13134,7 +13134,7 @@
     

     public const int MyFloatFieldNumber = 101;

     private bool hasMyFloat;

-    private float myFloat_ = 0F;

+    private float myFloat_;

     public bool HasMyFloat {

       get { return hasMyFloat; }

     }

@@ -13504,7 +13504,7 @@
     

     public const int ZeroFloatFieldNumber = 7;

     private bool hasZeroFloat;

-    private float zeroFloat_ = 0F;

+    private float zeroFloat_;

     public bool HasZeroFloat {

       get { return hasZeroFloat; }

     }

@@ -17478,7 +17478,7 @@
         

         public const int DynamicFieldFieldNumber = 2100;

         private bool hasDynamicField;

-        private int dynamicField_ = 0;

+        private int dynamicField_;

         public bool HasDynamicField {

           get { return hasDynamicField; }

         }

@@ -17693,7 +17693,7 @@
     

     public const int ScalarExtensionFieldNumber = 2000;

     private bool hasScalarExtension;

-    private uint scalarExtension_ = 0;

+    private uint scalarExtension_;

     public bool HasScalarExtension {

       get { return hasScalarExtension; }

     }

@@ -17780,10 +17780,10 @@
         output.WriteFixed32(2000, field_names[6], ScalarExtension);

       }

       if (hasEnumExtension) {

-        output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension.ToString());

+        output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension);

       }

       if (hasDynamicEnumExtension) {

-        output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension.ToString());

+        output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension);

       }

       if (hasMessageExtension) {

         output.WriteMessage(2003, field_names[3], MessageExtension);