Browse Source

Change "typeof (Foo)" to "typeof(Foo)" everywhere. I have no idea why I used to
include the space - it definitely doesn't look idiomatic...

Jon Skeet 13 năm trước cách đây
mục cha
commit
2be3870a5f

+ 21 - 21
src/ProtoGen.Test/TestPreprocessing.cs

@@ -112,7 +112,7 @@ message MyMessage {
                 args.Add(String.Format(@"""/out:{0}""", tempDll.TempPath));
                 args.Add("/r:System.dll");
                 args.Add(String.Format(@"""/r:{0}""",
-                                       typeof (Google.ProtocolBuffers.DescriptorProtos.DescriptorProto).Assembly.
+                                       typeof(Google.ProtocolBuffers.DescriptorProtos.DescriptorProto).Assembly.
                                            Location));
                 args.AddRange(sources);
 
@@ -162,7 +162,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -188,7 +188,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple." + test, true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple.Proto." + test, true, true);
             }
@@ -206,7 +206,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("MyNewNamespace.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("MyNewNamespace." + test, true, true);
             }
@@ -224,7 +224,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple.MyUmbrellaClassname", true, true);
             }
@@ -242,7 +242,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -260,7 +260,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -290,7 +290,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath, "/warnaserror+");
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -308,7 +308,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -326,7 +326,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple.MyUmbrella.Namespace." + test, true, true);
             }
@@ -344,7 +344,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -387,7 +387,7 @@ message " +
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -421,7 +421,7 @@ option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace"";
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("MyNewNamespace.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("MyNewNamespace." + test, true, true);
             }
@@ -493,7 +493,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("MyNewNamespace.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("MyNewNamespace." + test, true, true);
             }
@@ -532,7 +532,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("MyNewNamespace.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("MyNewNamespace." + test, true, true);
             }
@@ -560,7 +560,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -580,7 +580,7 @@ message MyMessage {
                 Assembly a = RunCsc(0, source.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple." + test, true, true);
             }
@@ -620,10 +620,10 @@ message MyMessageList {
                 Assembly a = RunCsc(0, source1.TempPath, source2.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t1 = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t1), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage");
                 //assert that the message type is in the expected namespace
                 Type t2 = a.GetType("nunit.simple.MyMessageList", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t2), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple.Proto.MyMessage", true, true);
                 a.GetType("nunit.simple.Proto.MyMessageList", true, true);
@@ -664,10 +664,10 @@ message MyMessageList {
                 Assembly a = RunCsc(0, source1.TempPath, source2.TempPath);
                 //assert that the message type is in the expected namespace
                 Type t1 = a.GetType("nunit.simple.MyMessage", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t1), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage");
                 //assert that the message type is in the expected namespace
                 Type t2 = a.GetType("nunit.simple.MyMessageList", true, true);
-                Assert.IsTrue(typeof (IMessage).IsAssignableFrom(t2), "Expect an IMessage");
+                Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage");
                 //assert that we can find the static descriptor type
                 a.GetType("nunit.simple.Proto.MyMessage", true, true);
                 a.GetType("nunit.simple.Proto.MyMessageList", true, true);

+ 7 - 7
src/ProtoGen/SourceGenerators.cs

@@ -47,12 +47,12 @@ namespace Google.ProtocolBuffers.ProtoGen
         private static readonly Dictionary<Type, Func<IDescriptor, ISourceGenerator>> GeneratorFactories =
             new Dictionary<Type, Func<IDescriptor, ISourceGenerator>>
                 {
-                    {typeof (FileDescriptor), descriptor => new UmbrellaClassGenerator((FileDescriptor) descriptor)},
-                    {typeof (EnumDescriptor), descriptor => new EnumGenerator((EnumDescriptor) descriptor)},
-                    {typeof (ServiceDescriptor), descriptor => new ServiceGenerator((ServiceDescriptor) descriptor)},
-                    {typeof (MessageDescriptor), descriptor => new MessageGenerator((MessageDescriptor) descriptor)},
+                    {typeof(FileDescriptor), descriptor => new UmbrellaClassGenerator((FileDescriptor) descriptor)},
+                    {typeof(EnumDescriptor), descriptor => new EnumGenerator((EnumDescriptor) descriptor)},
+                    {typeof(ServiceDescriptor), descriptor => new ServiceGenerator((ServiceDescriptor) descriptor)},
+                    {typeof(MessageDescriptor), descriptor => new MessageGenerator((MessageDescriptor) descriptor)},
                     // For other fields, we have IFieldSourceGenerators.
-                    {typeof (FieldDescriptor), descriptor => new ExtensionGenerator((FieldDescriptor) descriptor)}
+                    {typeof(FieldDescriptor), descriptor => new ExtensionGenerator((FieldDescriptor) descriptor)}
                 };
 
         public static IFieldSourceGenerator CreateFieldGenerator(FieldDescriptor field, int fieldOrdinal)
@@ -77,9 +77,9 @@ namespace Google.ProtocolBuffers.ProtoGen
         public static ISourceGenerator CreateGenerator<T>(T descriptor) where T : IDescriptor
         {
             Func<IDescriptor, ISourceGenerator> factory;
-            if (!GeneratorFactories.TryGetValue(typeof (T), out factory))
+            if (!GeneratorFactories.TryGetValue(typeof(T), out factory))
             {
-                throw new ArgumentException("No generator registered for " + typeof (T).Name);
+                throw new ArgumentException("No generator registered for " + typeof(T).Name);
             }
             return factory(descriptor);
         }

+ 3 - 3
src/ProtocolBuffers.Serialization/AbstractReader.cs

@@ -468,7 +468,7 @@ namespace Google.ProtocolBuffers.Serialization
             rawValue = null;
             if (ReadEnum(ref rawValue))
             {
-                if (Enum.IsDefined(typeof (T), rawValue))
+                if (Enum.IsDefined(typeof(T), rawValue))
                 {
                     if (rawValue is int)
                     {
@@ -476,7 +476,7 @@ namespace Google.ProtocolBuffers.Serialization
                     }
                     else if (rawValue is string)
                     {
-                        value = (T) Enum.Parse(typeof (T), (string) rawValue, false);
+                        value = (T) Enum.Parse(typeof(T), (string) rawValue, false);
                     }
                     else
                     {
@@ -565,7 +565,7 @@ namespace Google.ProtocolBuffers.Serialization
                     }
                     else if (rawValue is string)
                     {
-                        list.Add((T) Enum.Parse(typeof (T), (string) rawValue, false));
+                        list.Add((T) Enum.Parse(typeof(T), (string) rawValue, false));
                     }
                     else
                     {

+ 10 - 10
src/ProtocolBuffers.Serialization/AbstractTextReader.cs

@@ -23,7 +23,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref string value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (string)))
+            if (ReadAsText(ref text, typeof(string)))
             {
                 value = text;
                 return true;
@@ -37,7 +37,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref bool value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (bool)))
+            if (ReadAsText(ref text, typeof(bool)))
             {
                 value = XmlConvert.ToBoolean(text);
                 return true;
@@ -51,7 +51,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref int value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (int)))
+            if (ReadAsText(ref text, typeof(int)))
             {
                 value = XmlConvert.ToInt32(text);
                 return true;
@@ -66,7 +66,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref uint value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (uint)))
+            if (ReadAsText(ref text, typeof(uint)))
             {
                 value = XmlConvert.ToUInt32(text);
                 return true;
@@ -80,7 +80,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref long value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (long)))
+            if (ReadAsText(ref text, typeof(long)))
             {
                 value = XmlConvert.ToInt64(text);
                 return true;
@@ -95,7 +95,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref ulong value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (ulong)))
+            if (ReadAsText(ref text, typeof(ulong)))
             {
                 value = XmlConvert.ToUInt64(text);
                 return true;
@@ -109,7 +109,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref float value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (float)))
+            if (ReadAsText(ref text, typeof(float)))
             {
                 value = XmlConvert.ToSingle(text);
                 return true;
@@ -123,7 +123,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref double value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (double)))
+            if (ReadAsText(ref text, typeof(double)))
             {
                 value = XmlConvert.ToDouble(text);
                 return true;
@@ -145,7 +145,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool Read(ref ByteString value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (ByteString)))
+            if (ReadAsText(ref text, typeof(ByteString)))
             {
                 value = DecodeBytes(text);
                 return true;
@@ -160,7 +160,7 @@ namespace Google.ProtocolBuffers.Serialization
         protected override bool ReadEnum(ref object value)
         {
             string text = null;
-            if (ReadAsText(ref text, typeof (Enum)))
+            if (ReadAsText(ref text, typeof(Enum)))
             {
                 int number;
                 if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out number))

+ 2 - 2
src/ProtocolBuffers.Serialization/DictionaryReader.cs

@@ -82,7 +82,7 @@ namespace Google.ProtocolBuffers.Serialization
                 {
                     if (obj is IConvertible)
                     {
-                        value = (T) Convert.ChangeType(obj, typeof (T), CultureInfo.InvariantCulture);
+                        value = (T) Convert.ChangeType(obj, typeof(T), CultureInfo.InvariantCulture);
                     }
                     else
                     {
@@ -207,7 +207,7 @@ namespace Google.ProtocolBuffers.Serialization
             object[] array = null;
             if (GetValue(ref array))
             {
-                if (typeof (T) == typeof (ByteString))
+                if (typeof(T) == typeof(ByteString))
                 {
                     ICollection<ByteString> output = (ICollection<ByteString>) items;
                     foreach (byte[] item in array)

+ 1 - 1
src/ProtocolBuffers.Serialization/JsonFormatReader.cs

@@ -207,7 +207,7 @@ namespace Google.ProtocolBuffers.Serialization
 
             //exponent representation of integer number:
             if (value != null && type == JsonCursor.JsType.Number &&
-                (typeInfo != typeof (double) && typeInfo != typeof (float)) &&
+                (typeInfo != typeof(double) && typeInfo != typeof(float)) &&
                 value.IndexOf("e", StringComparison.OrdinalIgnoreCase) > 0)
             {
                 value = XmlConvert.ToString((long) Math.Round(XmlConvert.ToDouble(value), 0));

+ 1 - 1
src/ProtocolBuffers.Test/ExtendableMessageTest.cs

@@ -45,7 +45,7 @@ namespace Google.ProtocolBuffers
     [TestClass]
     public class ExtendableMessageTest
     {
-        [TestMethod, ExpectedException(typeof (ArgumentException))]
+        [TestMethod, ExpectedException(typeof(ArgumentException))]
         public void ExtensionWriterInvalidExtension()
         {
             TestPackedExtensions.CreateBuilder()[UnitTestProtoFile.OptionalForeignMessageExtension.Descriptor] =

+ 7 - 7
src/ProtocolBuffers.Test/MessageUtilTest.cs

@@ -44,14 +44,14 @@ namespace Google.ProtocolBuffers
     public class MessageUtilTest
     {
         [TestMethod]
-        [ExpectedException(typeof (ArgumentNullException))]
+        [ExpectedException(typeof(ArgumentNullException))]
         public void NullTypeName()
         {
             MessageUtil.GetDefaultMessage((string) null);
         }
 
         [TestMethod]
-        [ExpectedException(typeof (ArgumentException))]
+        [ExpectedException(typeof(ArgumentException))]
         public void InvalidTypeName()
         {
             MessageUtil.GetDefaultMessage("invalidtypename");
@@ -61,27 +61,27 @@ namespace Google.ProtocolBuffers
         public void ValidTypeName()
         {
             Assert.AreSame(TestAllTypes.DefaultInstance,
-                           MessageUtil.GetDefaultMessage(typeof (TestAllTypes).AssemblyQualifiedName));
+                           MessageUtil.GetDefaultMessage(typeof(TestAllTypes).AssemblyQualifiedName));
         }
 
         [TestMethod]
-        [ExpectedException(typeof (ArgumentNullException))]
+        [ExpectedException(typeof(ArgumentNullException))]
         public void NullType()
         {
             MessageUtil.GetDefaultMessage((Type) null);
         }
 
         [TestMethod]
-        [ExpectedException(typeof (ArgumentException))]
+        [ExpectedException(typeof(ArgumentException))]
         public void NonMessageType()
         {
-            MessageUtil.GetDefaultMessage(typeof (string));
+            MessageUtil.GetDefaultMessage(typeof(string));
         }
 
         [TestMethod]
         public void ValidType()
         {
-            Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof (TestAllTypes)));
+            Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes)));
         }
     }
 }

+ 2 - 2
src/ProtocolBuffers.Test/WireFormatTest.cs

@@ -51,11 +51,11 @@ namespace Google.ProtocolBuffers
         [TestMethod]
         public void FieldTypeToWireTypeMapping()
         {
-            foreach (FieldInfo field in typeof (FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
+            foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
             {
                 FieldType fieldType = (FieldType) field.GetValue(null);
                 FieldMappingAttribute mapping =
-                    (FieldMappingAttribute) field.GetCustomAttributes(typeof (FieldMappingAttribute), false)[0];
+                    (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
                 Assert.AreEqual(mapping.WireType, WireFormat.GetWireType(fieldType));
             }
         }

+ 1 - 1
src/ProtocolBuffers/CodedInputStream.cs

@@ -467,7 +467,7 @@ namespace Google.ProtocolBuffers
             where T : struct, IComparable, IFormattable, IConvertible
         {
             int number = (int) ReadRawVarint32();
-            if (Enum.IsDefined(typeof (T), number))
+            if (Enum.IsDefined(typeof(T), number))
             {
                 unknown = null;
                 value = (T) (object) number;

+ 2 - 2
src/ProtocolBuffers/Descriptors/FieldDescriptor.cs

@@ -441,11 +441,11 @@ namespace Google.ProtocolBuffers.Descriptors
         private static IDictionary<FieldType, MappedType> MapFieldTypes()
         {
             var map = new Dictionary<FieldType, MappedType>();
-            foreach (FieldInfo field in typeof (FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
+            foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
             {
                 FieldType fieldType = (FieldType) field.GetValue(null);
                 FieldMappingAttribute mapping =
-                    (FieldMappingAttribute) field.GetCustomAttributes(typeof (FieldMappingAttribute), false)[0];
+                    (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
                 map[fieldType] = mapping.MappedType;
             }
             return Dictionaries.AsReadOnly(map);

+ 2 - 2
src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs

@@ -63,11 +63,11 @@ namespace Google.ProtocolBuffers.Descriptors
         private static IDictionary<FieldType, FieldMappingAttribute> MapFieldTypes()
         {
             var map = new Dictionary<FieldType, FieldMappingAttribute>();
-            foreach (FieldInfo field in typeof (FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
+            foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
             {
                 FieldType fieldType = (FieldType) field.GetValue(null);
                 FieldMappingAttribute mapping =
-                    (FieldMappingAttribute) field.GetCustomAttributes(typeof (FieldMappingAttribute), false)[0];
+                    (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
                 map[fieldType] = mapping;
             }
             return Dictionaries.AsReadOnly(map);

+ 3 - 3
src/ProtocolBuffers/EnumLite.cs

@@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers
                 items.Add(Convert.ToInt32(evalue), new EnumValue(evalue));
             }
 #else
-            foreach (TEnum evalue in Enum.GetValues(typeof (TEnum)))
+            foreach (TEnum evalue in Enum.GetValues(typeof(TEnum)))
             {
                 items.Add(Convert.ToInt32(evalue), new EnumValue(evalue));
             }
@@ -128,9 +128,9 @@ namespace Google.ProtocolBuffers
         public IEnumLite FindValueByName(string name)
         {
             IEnumLite val;
-            if (Enum.IsDefined(typeof (TEnum), name))
+            if (Enum.IsDefined(typeof(TEnum), name))
             {
-                return items.TryGetValue((int) Enum.Parse(typeof (TEnum), name, false), out val) ? val : null;
+                return items.TryGetValue((int) Enum.Parse(typeof(TEnum), name, false), out val) ? val : null;
             }
             return null;
         }

+ 11 - 11
src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs

@@ -56,8 +56,8 @@ namespace Google.ProtocolBuffers.FieldAccess
         public static Func<T, object> CreateUpcastDelegate<T>(MethodInfo method)
         {
             // The tricky bit is invoking CreateCreateUpcastDelegateImpl with the right type parameters
-            MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateUpcastDelegateImpl");
-            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.ReturnType);
+            MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateUpcastDelegateImpl");
+            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.ReturnType);
             return (Func<T, object>) closedImpl.Invoke(null, new object[] {method});
         }
 
@@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.FieldAccess
             // Convert the reflection call into an open delegate, i.e. instead of calling x.Method()
             // we'll call getter(x).
             Func<TSource, TResult> getter =
-                (Func<TSource, TResult>) Delegate.CreateDelegate(typeof (Func<TSource, TResult>), null, method);
+                (Func<TSource, TResult>) Delegate.CreateDelegate(typeof(Func<TSource, TResult>), null, method);
 
             // Implicit upcast to object (within the delegate)
             return delegate(TSource source) { return getter(source); };
@@ -83,8 +83,8 @@ namespace Google.ProtocolBuffers.FieldAccess
         /// </summary>
         public static Action<T, object> CreateDowncastDelegate<T>(MethodInfo method)
         {
-            MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateDowncastDelegateImpl");
-            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.GetParameters()[0].ParameterType);
+            MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateImpl");
+            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType);
             return (Action<T, object>) closedImpl.Invoke(null, new object[] {method});
         }
 
@@ -93,7 +93,7 @@ namespace Google.ProtocolBuffers.FieldAccess
             // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll
             // call Method(x, y)
             Action<TSource, TParam> call =
-                (Action<TSource, TParam>) Delegate.CreateDelegate(typeof (Action<TSource, TParam>), null, method);
+                (Action<TSource, TParam>) Delegate.CreateDelegate(typeof(Action<TSource, TParam>), null, method);
 
             return delegate(TSource source, object parameter) { call(source, (TParam) parameter); };
         }
@@ -104,8 +104,8 @@ namespace Google.ProtocolBuffers.FieldAccess
         /// </summary>
         public static Action<T, object> CreateDowncastDelegateIgnoringReturn<T>(MethodInfo method)
         {
-            MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateDowncastDelegateIgnoringReturnImpl");
-            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.GetParameters()[0].ParameterType,
+            MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateIgnoringReturnImpl");
+            MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType,
                                                                method.ReturnType);
             return (Action<T, object>) closedImpl.Invoke(null, new object[] {method});
         }
@@ -116,7 +116,7 @@ namespace Google.ProtocolBuffers.FieldAccess
             // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll
             // call Method(x, y)
             Func<TSource, TParam, TReturn> call = (Func<TSource, TParam, TReturn>)
-                                                  Delegate.CreateDelegate(typeof (Func<TSource, TParam, TReturn>), null,
+                                                  Delegate.CreateDelegate(typeof(Func<TSource, TParam, TReturn>), null,
                                                                           method);
 
             return delegate(TSource source, object parameter) { call(source, (TParam) parameter); };
@@ -127,14 +127,14 @@ namespace Google.ProtocolBuffers.FieldAccess
         /// </summary>
         public static Func<IBuilder> CreateStaticUpcastDelegate(MethodInfo method)
         {
-            MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateStaticUpcastDelegateImpl");
+            MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateStaticUpcastDelegateImpl");
             MethodInfo closedImpl = openImpl.MakeGenericMethod(method.ReturnType);
             return (Func<IBuilder>) closedImpl.Invoke(null, new object[] {method});
         }
 
         public static Func<IBuilder> CreateStaticUpcastDelegateImpl<T>(MethodInfo method)
         {
-            Func<T> call = (Func<T>) Delegate.CreateDelegate(typeof (Func<T>), null, method);
+            Func<T> call = (Func<T>) Delegate.CreateDelegate(typeof(Func<T>), null, method);
             return delegate { return (IBuilder) call(); };
         }
     }

+ 1 - 1
src/ProtocolBuffers/GeneratedExtensionBase.cs

@@ -85,7 +85,7 @@ namespace Google.ProtocolBuffers
                 if (defaultInstanceProperty == null)
                 {
                     throw new ArgumentException("No public static DefaultInstance property for type " +
-                                                typeof (TExtension).Name);
+                                                typeof(TExtension).Name);
                 }
 
                 messageDefaultInstance = (IMessageLite) defaultInstanceProperty.GetValue(null, null);

+ 1 - 1
src/ProtocolBuffers/GeneratedRepeatExtension.cs

@@ -46,7 +46,7 @@ namespace Google.ProtocolBuffers
     /// </summary>
     public sealed class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>>
     {
-        private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof (TExtensionElement))
+        private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement))
         {
         }
 

+ 1 - 1
src/ProtocolBuffers/GeneratedSingleExtension.cs

@@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers
     /// </remarks>
     public sealed class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension>
     {
-        internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof (TExtension))
+        internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension))
         {
         }
 

+ 14 - 14
src/ProtocolBuffers/MessageStreamIterator.cs

@@ -84,16 +84,16 @@ namespace Google.ProtocolBuffers
                 Type builderType = FindBuilderType();
 
                 // Yes, it's redundant to find this again, but it's only the once...
-                MethodInfo createBuilderMethod = typeof (TMessage).GetMethod("CreateBuilder", EmptyTypes);
+                MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes);
                 Delegate builderBuilder = Delegate.CreateDelegate(
-                    typeof (Func<>).MakeGenericType(builderType), null, createBuilderMethod);
+                    typeof(Func<>).MakeGenericType(builderType), null, createBuilderMethod);
 
-                MethodInfo buildMethod = typeof (MessageStreamIterator<TMessage>)
+                MethodInfo buildMethod = typeof(MessageStreamIterator<TMessage>)
                     .GetMethod("BuildImpl", BindingFlags.Static | BindingFlags.NonPublic)
-                    .MakeGenericMethod(typeof (TMessage), builderType);
+                    .MakeGenericMethod(typeof(TMessage), builderType);
 
                 return (Func<CodedInputStream, ExtensionRegistry, TMessage>) Delegate.CreateDelegate(
-                    typeof (Func<CodedInputStream, ExtensionRegistry, TMessage>), builderBuilder, buildMethod);
+                    typeof(Func<CodedInputStream, ExtensionRegistry, TMessage>), builderBuilder, buildMethod);
             }
             catch (ArgumentException e)
             {
@@ -116,28 +116,28 @@ namespace Google.ProtocolBuffers
         /// </summary>
         private static Type FindBuilderType()
         {
-            MethodInfo createBuilderMethod = typeof (TMessage).GetMethod("CreateBuilder", EmptyTypes);
+            MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes);
             if (createBuilderMethod == null)
             {
-                throw new ArgumentException("Message type " + typeof (TMessage).FullName +
+                throw new ArgumentException("Message type " + typeof(TMessage).FullName +
                                             " has no CreateBuilder method.");
             }
-            if (createBuilderMethod.ReturnType == typeof (void))
+            if (createBuilderMethod.ReturnType == typeof(void))
             {
-                throw new ArgumentException("CreateBuilder method in " + typeof (TMessage).FullName +
+                throw new ArgumentException("CreateBuilder method in " + typeof(TMessage).FullName +
                                             " has void return type");
             }
             Type builderType = createBuilderMethod.ReturnType;
-            Type messageInterface = typeof (IMessage<,>).MakeGenericType(typeof (TMessage), builderType);
-            Type builderInterface = typeof (IBuilder<,>).MakeGenericType(typeof (TMessage), builderType);
-            if (Array.IndexOf(typeof (TMessage).GetInterfaces(), messageInterface) == -1)
+            Type messageInterface = typeof(IMessage<,>).MakeGenericType(typeof(TMessage), builderType);
+            Type builderInterface = typeof(IBuilder<,>).MakeGenericType(typeof(TMessage), builderType);
+            if (Array.IndexOf(typeof(TMessage).GetInterfaces(), messageInterface) == -1)
             {
-                throw new ArgumentException("Message type " + typeof (TMessage) + " doesn't implement " +
+                throw new ArgumentException("Message type " + typeof(TMessage) + " doesn't implement " +
                                             messageInterface.FullName);
             }
             if (Array.IndexOf(builderType.GetInterfaces(), builderInterface) == -1)
             {
-                throw new ArgumentException("Builder type " + typeof (TMessage) + " doesn't implement " +
+                throw new ArgumentException("Builder type " + typeof(TMessage) + " doesn't implement " +
                                             builderInterface.FullName);
             }
             return builderType;

+ 1 - 1
src/ProtocolBuffers/MessageUtil.cs

@@ -65,7 +65,7 @@ namespace Google.ProtocolBuffers
                 throw new ArgumentException("Unable to get a default message for an abstract or generic type (" +
                                             type.FullName + ")");
             }
-            if (!typeof (IMessage).IsAssignableFrom(type))
+            if (!typeof(IMessage).IsAssignableFrom(type))
             {
                 throw new ArgumentException("Unable to get a default message for non-message type (" + type.FullName +
                                             ")");

+ 1 - 1
src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs

@@ -255,7 +255,7 @@ namespace Google.ProtocolBuffers
             TestUtil.AssertBytesEqual(msg.ToByteArray(), TestRequiredLite.DefaultInstance.ToByteArray());
         }
 
-        [TestMethod, ExpectedException(typeof (UninitializedMessageException))]
+        [TestMethod, ExpectedException(typeof(UninitializedMessageException))]
         public void TestIBuilderLiteWeakBuildUninitialized()
         {
             IBuilderLite builder = TestRequiredLite.CreateBuilder();

+ 1 - 1
src/ProtocolBuffersLite.Test/AbstractMessageLiteTest.cs

@@ -111,7 +111,7 @@ namespace Google.ProtocolBuffers
         public void TestIMessageLiteWeakCreateBuilderForType()
         {
             IMessageLite msg = TestRequiredLite.DefaultInstance;
-            Assert.AreEqual(typeof (TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType());
+            Assert.AreEqual(typeof(TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType());
         }
 
         [TestMethod]

+ 3 - 3
src/ProtocolBuffersLite.Test/ExtendableBuilderLiteTest.cs

@@ -128,7 +128,7 @@ namespace Google.ProtocolBuffers
                 Assert.AreEqual(i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i));
         }
 
-        [TestMethod, ExpectedException(typeof (ArgumentOutOfRangeException))]
+        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void TestGetExtensionTIndexOutOfRange()
         {
             TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
@@ -154,7 +154,7 @@ namespace Google.ProtocolBuffers
                 Assert.AreEqual(5 + i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i));
         }
 
-        [TestMethod, ExpectedException(typeof (ArgumentOutOfRangeException))]
+        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void TestSetExtensionTIndexOutOfRange()
         {
             TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
@@ -209,7 +209,7 @@ namespace Google.ProtocolBuffers
             Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0));
         }
 
-        [TestMethod, ExpectedException(typeof (ArgumentOutOfRangeException))]
+        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void TestIndexedByDescriptorAndOrdinalOutOfRange()
         {
             TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();

+ 1 - 1
src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs

@@ -47,7 +47,7 @@ namespace Google.ProtocolBuffers
     public class ExtendableMessageLiteTest
     {
         //The lite framework does not make this assertion
-        //[TestMethod, Ignore, ExpectedException(typeof (ArgumentException))]
+        //[TestMethod, Ignore, ExpectedException(typeof(ArgumentException))]
         //public void ExtensionWriterInvalidExtension()
         //{
         //    TestPackedExtensionsLite.CreateBuilder()[