Support Compact Framework 3.5
diff --git a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
index c1c3670..43036f9 100644
--- a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
+++ b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
@@ -64,13 +64,12 @@
     public static Func<TSource, object> CreateUpcastDelegateImpl<TSource, TResult>(MethodInfo method) {
       // 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>), method);
+      Func<TSource, TResult> getter = (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); };
     }
 
-
     /// <summary>
     /// Creates a delegate which will execute the given method after casting the parameter
     /// down from object to the required parameter type.
@@ -84,7 +83,7 @@
     public static Action<TSource, object> CreateDowncastDelegateImpl<TSource, TParam>(MethodInfo method) {
       // 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>), method);
+      Action<TSource, TParam> call = (Action<TSource, TParam>) Delegate.CreateDelegate(typeof(Action<TSource, TParam>), null, method);
 
       return delegate(TSource source, object parameter) { call(source, (TParam)parameter); };
     }
@@ -103,7 +102,7 @@
       // 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>), method);
+          Delegate.CreateDelegate(typeof(Func<TSource, TParam, TReturn>), null, method);
 
       return delegate(TSource source, object parameter) { call(source, (TParam)parameter); };
     }
@@ -118,7 +117,7 @@
     }
 
     public static Func<IBuilder> CreateStaticUpcastDelegateImpl<T>(MethodInfo method) {
-      Func<T> call = (Func<T>)Delegate.CreateDelegate(typeof(Func<T>), method);
+      Func<T> call = (Func<T>)Delegate.CreateDelegate(typeof(Func<T>), null, method);
       return delegate { return (IBuilder)call(); };
     }
   }
diff --git a/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs b/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
index 5cca974..893b028 100644
--- a/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
+++ b/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
@@ -52,7 +52,7 @@
     private readonly Func<IBuilder> createBuilderDelegate;
 
     internal RepeatedMessageAccessor(string name) : base(name) {
-      MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", Type.EmptyTypes);
+      MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", EmptyTypes);
       if (createBuilderMethod == null) {
         throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name);
       }
diff --git a/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs b/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
index e5bb411..6bae59c 100644
--- a/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
+++ b/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
@@ -35,7 +35,7 @@
 
 namespace Google.ProtocolBuffers.FieldAccess {
   /// <summary>
-  /// Accesor for a repeated field of type int, ByteString etc.
+  /// Accessor for a repeated field of type int, ByteString etc.
   /// </summary>
   internal class RepeatedPrimitiveAccessor<TMessage, TBuilder> : IFieldAccessor<TMessage, TBuilder>
       where TMessage : IMessage<TMessage, TBuilder>
@@ -49,7 +49,9 @@
     private readonly Func<TMessage, int> countDelegate;
     private readonly MethodInfo getElementMethod;
     private readonly MethodInfo setElementMethod;
-    
+
+    // Replacement for Type.EmptyTypes which apparently isn't available on the compact framework
+    internal static readonly Type[] EmptyTypes = new Type[0];
 
     /// <summary>
     /// The CLR type of the field (int, the enum type, ByteString, the message etc).
@@ -64,7 +66,7 @@
       PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List");
       PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List");
       PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count");
-      MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes);
+      MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes);
       getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] { typeof(int) });
       clrType = getElementMethod.ReturnType;
       MethodInfo addMethod = typeof(TBuilder).GetMethod("Add" + name, new Type[] { ClrType });
@@ -78,9 +80,9 @@
           || setElementMethod == null) {
         throw new ArgumentException("Not all required properties/methods available");
       }
-      clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), clearMethod);
+      clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), null, clearMethod);
       countDelegate = (Func<TMessage, int>)Delegate.CreateDelegate
-          (typeof(Func<TMessage, int>), countProperty.GetGetMethod());
+          (typeof(Func<TMessage, int>), null, countProperty.GetGetMethod());
       getValueDelegate = ReflectionUtil.CreateUpcastDelegate<TMessage>(messageProperty.GetGetMethod());
       addValueDelegate = ReflectionUtil.CreateDowncastDelegateIgnoringReturn<TBuilder>(addMethod);
       getRepeatedWrapperDelegate = ReflectionUtil.CreateUpcastDelegate<TBuilder>(builderProperty.GetGetMethod());
diff --git a/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs b/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
index 9ce2cbb..ea422c9 100644
--- a/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
+++ b/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
@@ -48,7 +48,7 @@
     private readonly Func<IBuilder> createBuilderDelegate;
 
     internal SingleMessageAccessor(string name) : base(name) {
-      MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", Type.EmptyTypes);
+      MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", EmptyTypes);
       if (createBuilderMethod == null) {
         throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name);
       }
diff --git a/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs b/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs
index 8b3153a..1bc1d8e 100644
--- a/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs
+++ b/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs
@@ -46,6 +46,8 @@
     private readonly Func<TMessage, bool> hasDelegate;
     private readonly Func<TBuilder, IBuilder> clearDelegate;
 
+    internal static readonly Type[] EmptyTypes = new Type[0];
+
     /// <summary>
     /// The CLR type of the field (int, the enum type, ByteString, the message etc).
     /// As declared by the property.
@@ -59,13 +61,13 @@
       PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name);
       if (builderProperty == null) builderProperty = typeof(TBuilder).GetProperty(name);
       PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name);
-      MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes);
+      MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes);
       if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null) {
         throw new ArgumentException("Not all required properties/methods available");
       }
       clrType = messageProperty.PropertyType;
-      hasDelegate = (Func<TMessage, bool>)Delegate.CreateDelegate(typeof(Func<TMessage, bool>), hasProperty.GetGetMethod());
-      clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), clearMethod);
+      hasDelegate = (Func<TMessage, bool>)Delegate.CreateDelegate(typeof(Func<TMessage, bool>), null, hasProperty.GetGetMethod());
+      clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), null ,clearMethod);
       getValueDelegate = ReflectionUtil.CreateUpcastDelegate<TMessage>(messageProperty.GetGetMethod());
       setValueDelegate = ReflectionUtil.CreateDowncastDelegate<TBuilder>(builderProperty.GetSetMethod());
     }