Quellcode durchsuchen

Copyright fixes, a bit of documentation, and removed unnecessary using directives.

Jon Skeet vor 17 Jahren
Ursprung
Commit
48ce28bf2f
70 geänderte Dateien mit 1039 neuen und 181 gelöschten Zeilen
  1. 16 1
      csharp/ProtocolBuffers.Test/AbstractMessageTest.cs
  2. 2 2
      csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs
  3. 16 1
      csharp/ProtocolBuffers.Test/DescriptorsTest.cs
  4. 16 4
      csharp/ProtocolBuffers.Test/DynamicMessageTest.cs
  5. 16 4
      csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs
  6. 15 3
      csharp/ProtocolBuffers.Test/MessageTest.cs
  7. 17 4
      csharp/ProtocolBuffers.Test/ReflectionTester.cs
  8. 16 1
      csharp/ProtocolBuffers.Test/ServiceTest.cs
  9. 17 2
      csharp/ProtocolBuffers.Test/TestUtil.cs
  10. 16 1
      csharp/ProtocolBuffers.Test/TextFormatTest.cs
  11. 16 1
      csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs
  12. 16 4
      csharp/ProtocolBuffers.Test/WireFormatTest.cs
  13. 18 4
      csharp/ProtocolBuffers/AbstractBuilder.cs
  14. 1 1
      csharp/ProtocolBuffers/ByteString.cs
  15. 1 1
      csharp/ProtocolBuffers/CodedOutputStream.cs
  16. 17 4
      csharp/ProtocolBuffers/Collections/Dictionaries.cs
  17. 22 3
      csharp/ProtocolBuffers/Collections/Lists.cs
  18. 17 4
      csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs
  19. 19 1
      csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs
  20. 16 4
      csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs
  21. 15 4
      csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs
  22. 17 2
      csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs
  23. 18 2
      csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs
  24. 21 4
      csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs
  25. 20 3
      csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs
  26. 16 1
      csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs
  27. 20 2
      csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs
  28. 21 3
      csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs
  29. 17 4
      csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs
  30. 16 1
      csharp/ProtocolBuffers/Descriptors/FieldType.cs
  31. 19 4
      csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs
  32. 15 3
      csharp/ProtocolBuffers/Descriptors/IDescriptor.cs
  33. 15 3
      csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs
  34. 15 3
      csharp/ProtocolBuffers/Descriptors/MappedType.cs
  35. 17 2
      csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs
  36. 17 2
      csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs
  37. 6 11
      csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs
  38. 17 3
      csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs
  39. 21 4
      csharp/ProtocolBuffers/DynamicMessage.cs
  40. 15 2
      csharp/ProtocolBuffers/ExtendableBuilder.cs
  41. 17 3
      csharp/ProtocolBuffers/ExtendableMessage.cs
  42. 15 0
      csharp/ProtocolBuffers/ExtensionInfo.cs
  43. 0 11
      csharp/ProtocolBuffers/FieldAccess/Delegates.cs
  44. 17 2
      csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs
  45. 17 1
      csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs
  46. 15 1
      csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
  47. 15 1
      csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
  48. 15 1
      csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs
  49. 15 1
      csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
  50. 15 1
      csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs
  51. 18 4
      csharp/ProtocolBuffers/FieldSet.cs
  52. 16 4
      csharp/ProtocolBuffers/GeneratedBuilder.cs
  53. 16 2
      csharp/ProtocolBuffers/GeneratedExtensionBase.cs
  54. 16 3
      csharp/ProtocolBuffers/GeneratedMessage.cs
  55. 17 2
      csharp/ProtocolBuffers/GeneratedRepeatException.cs
  56. 17 2
      csharp/ProtocolBuffers/GeneratedSingleExtension.cs
  57. 16 1
      csharp/ProtocolBuffers/IRpcChannel.cs
  58. 16 1
      csharp/ProtocolBuffers/IRpcController.cs
  59. 16 3
      csharp/ProtocolBuffers/IService.cs
  60. 1 4
      csharp/ProtocolBuffers/InvalidProtocolBufferException.cs
  61. 16 2
      csharp/ProtocolBuffers/Properties/AssemblyInfo.cs
  62. 0 1
      csharp/ProtocolBuffers/ProtocolBuffers.csproj
  63. 19 3
      csharp/ProtocolBuffers/RpcUtil.cs
  64. 16 1
      csharp/ProtocolBuffers/TextFormat.cs
  65. 17 3
      csharp/ProtocolBuffers/TextGenerator.cs
  66. 16 1
      csharp/ProtocolBuffers/TextTokenizer.cs
  67. 1 1
      csharp/ProtocolBuffers/UninitializedMessageException.cs
  68. 17 2
      csharp/ProtocolBuffers/UnknownField.cs
  69. 16 3
      csharp/ProtocolBuffers/UnknownFieldSet.cs
  70. 3 3
      csharp/ProtocolBuffers/WireFormat.cs

+ 16 - 1
csharp/ProtocolBuffers.Test/AbstractMessageTest.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using NUnit.Framework;
 using NUnit.Framework;

+ 2 - 2
csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs

@@ -1,5 +1,4 @@
-using System.IO;
-// Protocol Buffers - Google's data interchange format
+// Protocol Buffers - Google's data interchange format
 // Copyright 2008 Google Inc.
 // Copyright 2008 Google Inc.
 // http://code.google.com/p/protobuf/
 // http://code.google.com/p/protobuf/
 //
 //
@@ -14,6 +13,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // See the License for the specific language governing permissions and
 // limitations under the License.
 // limitations under the License.
+using System.IO;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
 using NUnit.Framework;
 using NUnit.Framework;
 
 

+ 16 - 1
csharp/ProtocolBuffers.Test/DescriptorsTest.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using NUnit.Framework;
 using NUnit.Framework;

+ 16 - 4
csharp/ProtocolBuffers.Test/DynamicMessageTest.cs

@@ -1,8 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+using Google.ProtocolBuffers.TestProtos;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using NUnit.Framework;
 using NUnit.Framework;
-using Google.ProtocolBuffers.TestProtos;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   [TestFixture]
   [TestFixture]

+ 16 - 4
csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs

@@ -1,9 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
-using NUnit.Framework;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   [TestFixture]
   [TestFixture]

+ 15 - 3
csharp/ProtocolBuffers.Test/MessageTest.cs

@@ -1,6 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
 using NUnit.Framework;
 using NUnit.Framework;

+ 17 - 4
csharp/ProtocolBuffers.Test/ReflectionTester.cs

@@ -1,9 +1,22 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
-using NUnit.Framework;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>

+ 16 - 1
csharp/ProtocolBuffers.Test/ServiceTest.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
 using NUnit.Framework;
 using NUnit.Framework;

+ 17 - 2
csharp/ProtocolBuffers.Test/TestUtil.cs

@@ -1,7 +1,22 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
 using System.IO;
 using System.IO;
+using System.Text;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
 using NUnit.Framework;
 using NUnit.Framework;
 
 

+ 16 - 1
csharp/ProtocolBuffers.Test/TextFormatTest.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.IO;
 using System.IO;
 using System.Text;
 using System.Text;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;

+ 16 - 1
csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;

+ 16 - 4
csharp/ProtocolBuffers.Test/WireFormatTest.cs

@@ -1,9 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.TestProtos;
 using Google.ProtocolBuffers.TestProtos;
 using NUnit.Framework;
 using NUnit.Framework;
-using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   [TestFixture]
   [TestFixture]

+ 18 - 4
csharp/ProtocolBuffers/AbstractBuilder.cs

@@ -1,9 +1,23 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Google.ProtocolBuffers.Descriptors;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
+using System.Collections.Generic;
 using System.IO;
 using System.IO;
+using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>

+ 1 - 1
csharp/ProtocolBuffers/ByteString.cs

@@ -159,7 +159,7 @@ namespace Google.ProtocolBuffers {
     /// copying being involved. This has to be a nested type in order to have access
     /// copying being involved. This has to be a nested type in order to have access
     /// to the private ByteString constructor.
     /// to the private ByteString constructor.
     /// </summary>
     /// </summary>
-    internal class CodedBuilder {
+    internal sealed class CodedBuilder {
       private readonly CodedOutputStream output;
       private readonly CodedOutputStream output;
       private readonly byte[] buffer;
       private readonly byte[] buffer;
 
 

+ 1 - 1
csharp/ProtocolBuffers/CodedOutputStream.cs

@@ -698,7 +698,7 @@ namespace Google.ProtocolBuffers {
     /// Indicates that a CodedOutputStream wrapping a flat byte array
     /// Indicates that a CodedOutputStream wrapping a flat byte array
     /// ran out of space.
     /// ran out of space.
     /// </summary>
     /// </summary>
-    public class OutOfSpaceException : IOException {
+    public sealed class OutOfSpaceException : IOException {
       internal OutOfSpaceException()
       internal OutOfSpaceException()
         : base("CodedOutputStream was writing to a flat byte array and ran out of space.") {
         : base("CodedOutputStream was writing to a flat byte array and ran out of space.") {
       }
       }

+ 17 - 4
csharp/ProtocolBuffers/Collections/Dictionaries.cs

@@ -1,8 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
-using Google.ProtocolBuffers.Descriptors;
+using System.Collections.Generic;
 
 
 namespace Google.ProtocolBuffers.Collections {
 namespace Google.ProtocolBuffers.Collections {
 
 

+ 22 - 3
csharp/ProtocolBuffers/Collections/Lists.cs

@@ -1,19 +1,38 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Collections.ObjectModel;
-using System.Text;
 
 
 namespace Google.ProtocolBuffers.Collections {
 namespace Google.ProtocolBuffers.Collections {
 
 
+  /// <summary>
+  /// Utility non-generic class for calling into Lists{T} using type inference.
+  /// </summary>
   public static class Lists {
   public static class Lists {
 
 
+    /// <summary>
+    /// Returns a read-only view of the specified list.
+    /// </summary>
     public static IList<T> AsReadOnly<T>(IList<T> list) {
     public static IList<T> AsReadOnly<T>(IList<T> list) {
       return Lists<T>.AsReadOnly(list);
       return Lists<T>.AsReadOnly(list);
     }
     }
   }
   }
 
 
   /// <summary>
   /// <summary>
-  /// Utilities class for dealing with lists.
+  /// Utility class for dealing with lists.
   /// </summary>
   /// </summary>
   public static class Lists<T> {
   public static class Lists<T> {
 
 

+ 17 - 4
csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs

@@ -1,14 +1,27 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
-using IEnumerable=System.Collections.IEnumerable;
 
 
 namespace Google.ProtocolBuffers.Collections {
 namespace Google.ProtocolBuffers.Collections {
   /// <summary>
   /// <summary>
   /// Read-only wrapper around another dictionary.
   /// Read-only wrapper around another dictionary.
   /// </summary>
   /// </summary>
-  public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue> {
+  public sealed class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue> {
     readonly IDictionary<TKey, TValue> wrapped;
     readonly IDictionary<TKey, TValue> wrapped;
 
 
     public ReadOnlyDictionary(IDictionary<TKey, TValue> wrapped) {
     public ReadOnlyDictionary(IDictionary<TKey, TValue> wrapped) {

+ 19 - 1
csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs

@@ -1,4 +1,19 @@
-namespace Google.ProtocolBuffers.DescriptorProtos {
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+namespace Google.ProtocolBuffers.DescriptorProtos {
 
 
   /// <summary>
   /// <summary>
   /// Interface implemented by all DescriptorProtos. The generator doesn't
   /// Interface implemented by all DescriptorProtos. The generator doesn't
@@ -13,6 +28,9 @@
     /// </summary>
     /// </summary>
     string Name { get; }
     string Name { get; }
 
 
+    /// <summary>
+    /// The options for this descriptor.
+    /// </summary>
     TOptions Options { get; }
     TOptions Options { get; }
   }
   }
 }
 }

+ 16 - 4
csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs

@@ -1,8 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 
 
-// This class just contains partial classes for each of the
+// This file just contains partial classes for each of the
 // autogenerated classes, so that they implement
 // autogenerated classes, so that they implement
 // IDescriptorProto
 // IDescriptorProto
 namespace Google.ProtocolBuffers.DescriptorProtos {
 namespace Google.ProtocolBuffers.DescriptorProtos {

+ 15 - 4
csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs

@@ -1,8 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
-using Google.ProtocolBuffers.Collections;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>

+ 17 - 2
csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs

@@ -1,4 +1,19 @@
-using System.Collections.Generic;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System.Collections.Generic;
 using System;
 using System;
 using System.Text;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
@@ -7,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Contains lookup tables containing all the descriptors defined in a particular file.
   /// Contains lookup tables containing all the descriptors defined in a particular file.
   /// </summary>
   /// </summary>
-  internal class DescriptorPool {
+  internal sealed class DescriptorPool {
 
 
     private readonly IDictionary<string, IDescriptor> descriptorsByName =
     private readonly IDictionary<string, IDescriptor> descriptorsByName =
         new Dictionary<string, IDescriptor>();
         new Dictionary<string, IDescriptor>();

+ 18 - 2
csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs

@@ -1,10 +1,26 @@
-using System.Collections.Generic;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System.Collections.Generic;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
+
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Internal class containing utility methods when working with descriptors.
   /// Internal class containing utility methods when working with descriptors.
   /// </summary>
   /// </summary>
-  static class DescriptorUtil {
+  internal static class DescriptorUtil {
     /// <summary>
     /// <summary>
     /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
     /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
     /// arrays.
     /// arrays.

+ 21 - 4
csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs

@@ -1,9 +1,26 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
-  public class DescriptorValidationException : Exception {
+  /// <summary>
+  /// Thrown when building descriptors fails because the source DescriptorProtos
+  /// are not valid.
+  /// </summary>
+  public sealed class DescriptorValidationException : Exception {
 
 
     private readonly String name;
     private readonly String name;
     private readonly IMessage proto;
     private readonly IMessage proto;

+ 20 - 3
csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs

@@ -1,10 +1,27 @@
-
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System.Collections.Generic;
 using System.Collections.Generic;
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
+
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
 
 
-  public class EnumDescriptor : IndexedDescriptorBase<EnumDescriptorProto, EnumOptions> {
+  /// <summary>
+  /// Descriptor for an enum type in a .proto file.
+  /// </summary>
+  public sealed class EnumDescriptor : IndexedDescriptorBase<EnumDescriptorProto, EnumOptions> {
 
 
     private readonly MessageDescriptor containingType;
     private readonly MessageDescriptor containingType;
     private readonly IList<EnumValueDescriptor> values;
     private readonly IList<EnumValueDescriptor> values;

+ 16 - 1
csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>

+ 20 - 2
csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs

@@ -1,8 +1,26 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
-  public class EnumValueDescriptor : IndexedDescriptorBase<EnumValueDescriptorProto, EnumValueOptions> {
+  
+  /// <summary>
+  /// Descriptor for a single enum value within an enum in a .proto file.
+  /// </summary>
+  public sealed class EnumValueDescriptor : IndexedDescriptorBase<EnumValueDescriptorProto, EnumValueOptions> {
 
 
     private readonly EnumDescriptor enumDescriptor;
     private readonly EnumDescriptor enumDescriptor;
 
 

+ 21 - 3
csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs

@@ -1,12 +1,30 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Reflection;
 using System.Reflection;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
-using System.Collections.ObjectModel;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
-  public class FieldDescriptor : IndexedDescriptorBase<FieldDescriptorProto, FieldOptions>, IComparable<FieldDescriptor> {
+  
+  /// <summary>
+  /// Descriptor for a field or extension within a message in a .proto file.
+  /// </summary>
+  public sealed class FieldDescriptor : IndexedDescriptorBase<FieldDescriptorProto, FieldOptions>, IComparable<FieldDescriptor> {
 
 
     private readonly MessageDescriptor extensionScope;
     private readonly MessageDescriptor extensionScope;
     private EnumDescriptor enumType;
     private EnumDescriptor enumType;

+ 17 - 4
csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs

@@ -1,6 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
 
 
@@ -9,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors {
   /// this allows each field type to specify the mapped type and wire type.
   /// this allows each field type to specify the mapped type and wire type.
   /// </summary>
   /// </summary>
   [AttributeUsage(AttributeTargets.Field)]
   [AttributeUsage(AttributeTargets.Field)]
-  internal class FieldMappingAttribute : Attribute {
+  internal sealed class FieldMappingAttribute : Attribute {
     internal FieldMappingAttribute(MappedType mappedType, WireFormat.WireType wireType) {
     internal FieldMappingAttribute(MappedType mappedType, WireFormat.WireType wireType) {
       MappedType = mappedType;
       MappedType = mappedType;
       WireType = wireType;
       WireType = wireType;

+ 16 - 1
csharp/ProtocolBuffers/Descriptors/FieldType.cs

@@ -1,4 +1,19 @@
-
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Enumeration of all the possible field types. The odd formatting is to make it very clear
   /// Enumeration of all the possible field types. The odd formatting is to make it very clear

+ 19 - 4
csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs

@@ -1,8 +1,23 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
+using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Collections.ObjectModel;
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
-using System.Collections.Generic;
-using Google.ProtocolBuffers.Collections;
+
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
 
 
   /// <summary>
   /// <summary>
@@ -10,7 +25,7 @@ namespace Google.ProtocolBuffers.Descriptors {
   /// IDescriptor is implemented such that the File property returns this descriptor,
   /// IDescriptor is implemented such that the File property returns this descriptor,
   /// and the FullName is the same as the Name.
   /// and the FullName is the same as the Name.
   /// </summary>
   /// </summary>
-  public class FileDescriptor : IDescriptor<FileDescriptorProto> {
+  public sealed class FileDescriptor : IDescriptor<FileDescriptorProto> {
 
 
     private readonly FileDescriptorProto proto;
     private readonly FileDescriptorProto proto;
     private readonly IList<MessageDescriptor> messageTypes;
     private readonly IList<MessageDescriptor> messageTypes;

+ 15 - 3
csharp/ProtocolBuffers/Descriptors/IDescriptor.cs

@@ -1,6 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
 
 

+ 15 - 3
csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs

@@ -1,6 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {

+ 15 - 3
csharp/ProtocolBuffers/Descriptors/MappedType.cs

@@ -1,6 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>

+ 17 - 2
csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs

@@ -1,4 +1,19 @@
-using System.Collections.Generic;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System.Collections.Generic;
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
@@ -6,7 +21,7 @@ namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Describes a message type.
   /// Describes a message type.
   /// </summary>
   /// </summary>
-  public class MessageDescriptor : IndexedDescriptorBase<DescriptorProto, MessageOptions> {
+  public sealed class MessageDescriptor : IndexedDescriptorBase<DescriptorProto, MessageOptions> {
 
 
     private readonly MessageDescriptor containingType;
     private readonly MessageDescriptor containingType;
     private readonly IList<MessageDescriptor> nestedTypes;
     private readonly IList<MessageDescriptor> nestedTypes;

+ 17 - 2
csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs

@@ -1,10 +1,25 @@
-using Google.ProtocolBuffers.DescriptorProtos;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using Google.ProtocolBuffers.DescriptorProtos;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Describes a single method in a service.
   /// Describes a single method in a service.
   /// </summary>
   /// </summary>
-  public class MethodDescriptor : IndexedDescriptorBase<MethodDescriptorProto, MethodOptions> {
+  public sealed class MethodDescriptor : IndexedDescriptorBase<MethodDescriptorProto, MethodOptions> {
 
 
     private readonly ServiceDescriptor service;
     private readonly ServiceDescriptor service;
     private MessageDescriptor inputType;
     private MessageDescriptor inputType;

+ 6 - 11
csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs

@@ -3,17 +3,12 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
-    /*
-     * Represents a package in the symbol table.  We use PackageDescriptors
-     * just as placeholders so that someone cannot define, say, a message type
-     * that has the same name as an existing package.
-     */
-  /// <summary>
-  /// Represents a package in the symbol table.  We use PackageDescriptors
-  /// just as placeholders so that someone cannot define, say, a message type
-  /// that has the same name as an existing package.
-  /// </summary>
-    internal class PackageDescriptor : IDescriptor<IMessage> {
+    /// <summary>
+    /// Represents a package in the symbol table.  We use PackageDescriptors
+    /// just as placeholders so that someone cannot define, say, a message type
+    /// that has the same name as an existing package.
+    /// </summary>
+    internal sealed class PackageDescriptor : IDescriptor<IMessage> {
 
 
       private readonly string name;
       private readonly string name;
       private readonly string fullName;
       private readonly string fullName;

+ 17 - 3
csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs

@@ -1,6 +1,20 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
 using Google.ProtocolBuffers.DescriptorProtos;
 using Google.ProtocolBuffers.DescriptorProtos;
 
 
 namespace Google.ProtocolBuffers.Descriptors {
 namespace Google.ProtocolBuffers.Descriptors {
@@ -8,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors {
   /// <summary>
   /// <summary>
   /// Describes a service type.
   /// Describes a service type.
   /// </summary>
   /// </summary>
-  public class ServiceDescriptor : IndexedDescriptorBase<ServiceDescriptorProto, ServiceOptions> {
+  public sealed class ServiceDescriptor : IndexedDescriptorBase<ServiceDescriptorProto, ServiceOptions> {
 
 
     private readonly IList<MethodDescriptor> methods;
     private readonly IList<MethodDescriptor> methods;
 
 

+ 21 - 4
csharp/ProtocolBuffers/DynamicMessage.cs

@@ -1,7 +1,21 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
-using System.Text;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
@@ -9,7 +23,7 @@ namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
   /// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor.
   /// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor.
   /// </summary>
   /// </summary>
-  public class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder> {
+  public sealed class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder> {
 
 
     private readonly MessageDescriptor type;
     private readonly MessageDescriptor type;
     private readonly FieldSet fields;
     private readonly FieldSet fields;
@@ -226,7 +240,10 @@ namespace Google.ProtocolBuffers {
       }
       }
     }
     }
 
 
-    public class Builder : AbstractBuilder<DynamicMessage, DynamicMessage.Builder> {
+    /// <summary>
+    /// Builder for dynamic messages. Instances are created with DynamicMessage.CreateBuilder.
+    /// </summary>
+    public sealed class Builder : AbstractBuilder<DynamicMessage, Builder> {
       private readonly MessageDescriptor type;
       private readonly MessageDescriptor type;
       private FieldSet fields;
       private FieldSet fields;
       private UnknownFieldSet unknownFields;
       private UnknownFieldSet unknownFields;

+ 15 - 2
csharp/ProtocolBuffers/ExtendableBuilder.cs

@@ -1,6 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {

+ 17 - 3
csharp/ProtocolBuffers/ExtendableMessage.cs

@@ -1,8 +1,22 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
-using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
+using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   public abstract class ExtendableMessage<TMessage, TBuilder> : GeneratedMessage<TMessage, TBuilder>
   public abstract class ExtendableMessage<TMessage, TBuilder> : GeneratedMessage<TMessage, TBuilder>

+ 15 - 0
csharp/ProtocolBuffers/ExtensionInfo.cs

@@ -1,3 +1,18 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers
 namespace Google.ProtocolBuffers

+ 0 - 11
csharp/ProtocolBuffers/FieldAccess/Delegates.cs

@@ -1,11 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Google.ProtocolBuffers.FieldAccess {
-  /// <summary>
-  /// Declarations of delegate types used for field access. Can't
-  /// use Func and Action (other than one parameter) as we can't guarantee .NET 3.5.
-  /// </summary>
-  internal delegate bool HasFunction<TMessage>(TMessage message);  
-}

+ 17 - 2
csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {
@@ -8,7 +23,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
   /// create appropriate instances in the .proto file description class.
   /// create appropriate instances in the .proto file description class.
   /// TODO(jonskeet): See if we can hide it somewhere...
   /// TODO(jonskeet): See if we can hide it somewhere...
   /// </summary>
   /// </summary>
-  public class FieldAccessorTable {
+  public sealed class FieldAccessorTable {
 
 
     readonly IFieldAccessor[] accessors;
     readonly IFieldAccessor[] accessors;
 
 

+ 17 - 1
csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs

@@ -1,4 +1,20 @@
-namespace Google.ProtocolBuffers.FieldAccess {
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Google.ProtocolBuffers.FieldAccess {
 
 
   /// <summary>
   /// <summary>
   /// Allows fields to be reflectively accessed in a smart manner.
   /// Allows fields to be reflectively accessed in a smart manner.

+ 15 - 1
csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs

@@ -1,6 +1,20 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System;
 using System;
 using System.Reflection;
 using System.Reflection;
-using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {
 
 

+ 15 - 1
csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs

@@ -1,7 +1,21 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System;
 using System;
 using System.Collections;
 using System.Collections;
 using System.Reflection;
 using System.Reflection;
-using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {
   /// <summary>
   /// <summary>

+ 15 - 1
csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs

@@ -1,5 +1,19 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System;
 using System;
-using System.Collections.Generic;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {

+ 15 - 1
csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs

@@ -1,6 +1,20 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System;
 using System;
 using System.Reflection;
 using System.Reflection;
-using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {
   /// <summary>
   /// <summary>

+ 15 - 1
csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs

@@ -1,6 +1,20 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 using System;
 using System;
 using System.Reflection;
 using System.Reflection;
-using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers.FieldAccess {
 namespace Google.ProtocolBuffers.FieldAccess {
   /// <summary>
   /// <summary>

+ 18 - 4
csharp/ProtocolBuffers/FieldSet.cs

@@ -1,9 +1,23 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
-using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
+using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
@@ -20,7 +34,7 @@ namespace Google.ProtocolBuffers {
   /// 
   /// 
   /// All repeated fields are stored as IList[object] even 
   /// All repeated fields are stored as IList[object] even 
   /// </summary>
   /// </summary>
-  internal class FieldSet {
+  internal sealed class FieldSet {
 
 
     private static readonly FieldSet defaultInstance = new FieldSet(new Dictionary<FieldDescriptor, object>()).MakeImmutable();
     private static readonly FieldSet defaultInstance = new FieldSet(new Dictionary<FieldDescriptor, object>()).MakeImmutable();
 
 

+ 16 - 4
csharp/ProtocolBuffers/GeneratedBuilder.cs

@@ -1,10 +1,22 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Text;
-using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
-using System.IO;
 using Google.ProtocolBuffers.FieldAccess;
 using Google.ProtocolBuffers.FieldAccess;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {

+ 16 - 2
csharp/ProtocolBuffers/GeneratedExtensionBase.cs

@@ -1,8 +1,22 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Reflection;
 using System.Reflection;
-using System.Text;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {

+ 16 - 3
csharp/ProtocolBuffers/GeneratedMessage.cs

@@ -1,7 +1,20 @@
-using System;
-using System.Collections;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.IO;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.FieldAccess;
 using Google.ProtocolBuffers.FieldAccess;

+ 17 - 2
csharp/ProtocolBuffers/GeneratedRepeatException.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 using System.Collections;
 using System.Collections;
@@ -7,7 +22,7 @@ namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
   /// Class used to represent repeat extensions in generated classes.
   /// Class used to represent repeat extensions in generated classes.
   /// </summary>
   /// </summary>
-  public class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>> {
+  public sealed class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>> {
     private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement)) {
     private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement)) {
     }
     }
 
 

+ 17 - 2
csharp/ProtocolBuffers/GeneratedSingleExtension.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
@@ -6,7 +21,7 @@ namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
   /// Generated extension for a singular field.
   /// Generated extension for a singular field.
   /// </remarks>
   /// </remarks>
-  public class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension>  {
+  public sealed class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension>  {
     internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension)) {
     internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension)) {
     }
     }
 
 

+ 16 - 1
csharp/ProtocolBuffers/IRpcChannel.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {

+ 16 - 1
csharp/ProtocolBuffers/IRpcController.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>

+ 16 - 3
csharp/ProtocolBuffers/IService.cs

@@ -1,6 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {

+ 1 - 4
csharp/ProtocolBuffers/InvalidProtocolBufferException.cs

@@ -19,10 +19,8 @@ namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
   /// Thrown when a protocol message being parsed is invalid in some way,
   /// Thrown when a protocol message being parsed is invalid in some way,
   /// e.g. it contains a malformed varint or a negative byte length.
   /// e.g. it contains a malformed varint or a negative byte length.
-  /// 
-  /// TODO(jonskeet): Make the methods throw directly? Rename them?
   /// </summary>
   /// </summary>
-  public class InvalidProtocolBufferException : IOException {
+  public sealed class InvalidProtocolBufferException : IOException {
 
 
     internal InvalidProtocolBufferException(string message)
     internal InvalidProtocolBufferException(string message)
       : base(message) {
       : base(message) {
@@ -37,7 +35,6 @@ namespace Google.ProtocolBuffers {
         "misreported its own length.");
         "misreported its own length.");
     }
     }
 
 
-    /// TODO(jonskeet): Make this internal again and use InternalVisibleTo?
     internal static InvalidProtocolBufferException NegativeSize() {
     internal static InvalidProtocolBufferException NegativeSize() {
       return new InvalidProtocolBufferException(
       return new InvalidProtocolBufferException(
         "CodedInputStream encountered an embedded string or message " +
         "CodedInputStream encountered an embedded string or message " +

+ 16 - 2
csharp/ProtocolBuffers/Properties/AssemblyInfo.cs

@@ -1,5 +1,19 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 
 
 // General Information about an assembly is controlled through the following 
 // General Information about an assembly is controlled through the following 

+ 0 - 1
csharp/ProtocolBuffers/ProtocolBuffers.csproj

@@ -77,7 +77,6 @@
     <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" />
     <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" />
     <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" />
     <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" />
     <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" />
     <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" />
-    <Compile Include="FieldAccess\Delegates.cs" />
     <Compile Include="FieldAccess\IFieldAccessor.cs" />
     <Compile Include="FieldAccess\IFieldAccessor.cs" />
     <Compile Include="FieldAccess\FieldAccessorTable.cs" />
     <Compile Include="FieldAccess\FieldAccessorTable.cs" />
     <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" />
     <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" />

+ 19 - 3
csharp/ProtocolBuffers/RpcUtil.cs

@@ -1,8 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
+  /// <summary>
+  /// Grab-bag of utility functions useful when dealing with RPCs.
+  /// </summary>
   public static class RpcUtil {
   public static class RpcUtil {
 
 
     /// <summary>
     /// <summary>

+ 16 - 1
csharp/ProtocolBuffers/TextFormat.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Globalization;
 using System.IO;
 using System.IO;

+ 17 - 3
csharp/ProtocolBuffers/TextGenerator.cs

@@ -1,5 +1,19 @@
-using System;
-using System.Collections.Generic;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.IO;
 using System.IO;
 using System.Text;
 using System.Text;
 
 
@@ -8,7 +22,7 @@ namespace Google.ProtocolBuffers {
   /// <summary>
   /// <summary>
   /// Helper class to control indentation
   /// Helper class to control indentation
   /// </summary>
   /// </summary>
-  internal class TextGenerator {
+  internal sealed class TextGenerator {
 
 
     /// <summary>
     /// <summary>
     /// Writer to write formatted text to.
     /// Writer to write formatted text to.

+ 16 - 1
csharp/ProtocolBuffers/TextTokenizer.cs

@@ -1,4 +1,19 @@
-using System;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System;
 using System.Globalization;
 using System.Globalization;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
 
 

+ 1 - 1
csharp/ProtocolBuffers/UninitializedMessageException.cs

@@ -21,7 +21,7 @@ using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Descriptors;
 using Google.ProtocolBuffers.Descriptors;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
-  public class UninitializedMessageException : Exception {
+  public sealed class UninitializedMessageException : Exception {
 
 
     private readonly IList<string> missingFields;
     private readonly IList<string> missingFields;
 
 

+ 17 - 2
csharp/ProtocolBuffers/UnknownField.cs

@@ -1,4 +1,19 @@
-using System.Collections.Generic;
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.
+// http://code.google.com/p/protobuf/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Collections.ObjectModel;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
 
 
@@ -169,7 +184,7 @@ namespace Google.ProtocolBuffers {
     /// <summary>
     /// <summary>
     /// Used to build instances of UnknownField.
     /// Used to build instances of UnknownField.
     /// </summary>
     /// </summary>
-    public class Builder {
+    public sealed class Builder {
 
 
       private List<ulong> varintList;
       private List<ulong> varintList;
       private List<uint> fixed32List;
       private List<uint> fixed32List;

+ 16 - 3
csharp/ProtocolBuffers/UnknownFieldSet.cs

@@ -19,7 +19,18 @@ using System.IO;
 using Google.ProtocolBuffers.Collections;
 using Google.ProtocolBuffers.Collections;
 
 
 namespace Google.ProtocolBuffers {
 namespace Google.ProtocolBuffers {
-  public class UnknownFieldSet {
+  /// <summary>
+  /// Used to keep track of fields which were seen when parsing a protocol message
+  /// but whose field numbers or types are unrecognized. This most frequently
+  /// occurs when new fields are added to a message type and then messages containing
+  /// those fields are read by old software that was built before the new types were
+  /// added.
+  /// 
+  /// Every message contains an UnknownFieldSet.
+  /// 
+  /// Most users will never need to use this class directly.
+  /// </summary>
+  public sealed class UnknownFieldSet {
 
 
     private static readonly UnknownFieldSet defaultInstance = new UnknownFieldSet(new Dictionary<int, UnknownField>());
     private static readonly UnknownFieldSet defaultInstance = new UnknownFieldSet(new Dictionary<int, UnknownField>());
 
 
@@ -165,7 +176,6 @@ namespace Google.ProtocolBuffers {
       }
       }
     }
     }
 
 
-
     /// <summary>
     /// <summary>
     /// Parses an UnknownFieldSet from the given input.
     /// Parses an UnknownFieldSet from the given input.
     /// </summary>
     /// </summary>
@@ -194,7 +204,10 @@ namespace Google.ProtocolBuffers {
       return CreateBuilder().MergeFrom(input).Build();
       return CreateBuilder().MergeFrom(input).Build();
     }
     }
 
 
-    public class Builder
+    /// <summary>
+    /// Builder for UnknownFieldSets.
+    /// </summary>
+    public sealed class Builder
     {
     {
       /// <summary>
       /// <summary>
       /// Mapping from number to field. Note that by using a SortedList we ensure
       /// Mapping from number to field. Note that by using a SortedList we ensure

+ 3 - 3
csharp/ProtocolBuffers/WireFormat.cs

@@ -28,7 +28,7 @@ namespace Google.ProtocolBuffers {
   /// the Protocol Buffer wire format.
   /// the Protocol Buffer wire format.
   /// </para>
   /// </para>
   /// </summary>
   /// </summary>
-  public class WireFormat {
+  public static class WireFormat {
     public enum WireType : uint {
     public enum WireType : uint {
       Varint = 0,
       Varint = 0,
       Fixed64 = 1,
       Fixed64 = 1,
@@ -38,13 +38,13 @@ namespace Google.ProtocolBuffers {
       Fixed32 = 5
       Fixed32 = 5
     }
     }
 
 
-    internal class MessageSetField {
+    internal static class MessageSetField {
       internal const int Item = 1;
       internal const int Item = 1;
       internal const int TypeID = 2;
       internal const int TypeID = 2;
       internal const int Message = 3;
       internal const int Message = 3;
     }
     }
 
 
-    internal class MessageSetTag {
+    internal static class MessageSetTag {
       internal static readonly uint ItemStart = MakeTag(MessageSetField.Item, WireType.StartGroup);
       internal static readonly uint ItemStart = MakeTag(MessageSetField.Item, WireType.StartGroup);
       internal static readonly uint ItemEnd = MakeTag(MessageSetField.Item, WireType.EndGroup);
       internal static readonly uint ItemEnd = MakeTag(MessageSetField.Item, WireType.EndGroup);
       internal static readonly uint TypeID = MakeTag(MessageSetField.TypeID, WireType.Varint);
       internal static readonly uint TypeID = MakeTag(MessageSetField.TypeID, WireType.Varint);