diff options
author | Jon Skeet <jonskeet@google.com> | 2018-03-27 10:16:53 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2018-03-27 10:17:44 +0100 |
commit | 9c05c353414cc4439085151362756536511c2f0d (patch) | |
tree | c97657feb98f5567c1c2e518c7bb5f79f60067a6 /csharp/src/Google.Protobuf/Reflection | |
parent | 7b19d2088278e06a7b6a9720ddbfd5ec484ab14f (diff) | |
download | protobuf-9c05c353414cc4439085151362756536511c2f0d.tar.gz protobuf-9c05c353414cc4439085151362756536511c2f0d.tar.bz2 protobuf-9c05c353414cc4439085151362756536511c2f0d.zip |
Address review comments
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs b/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs index 3a5b3bd9..1afaa90c 100644 --- a/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs +++ b/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs @@ -56,32 +56,40 @@ namespace Google.Protobuf.Reflection internal static readonly Type[] EmptyTypes = new Type[0]; /// <summary> - /// Creates a delegate which will cast the argument to the appropriate method target type, + /// Creates a delegate which will cast the argument to the type that declares the method, /// call the method on it, then convert the result to object. /// </summary> + /// <param name="method">The method to create a delegate for, which must be declared in an IMessage + /// implementation.</param> internal static Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method) => GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageObject(method); /// <summary> - /// Creates a delegate which will cast the argument to the appropriate method target type, + /// Creates a delegate which will cast the argument to the type that declares the method, /// call the method on it, then convert the result to the specified type. The method is expected /// to actually return an enum (because of where we're calling it - for oneof cases). Sometimes that /// means we need some extra work to perform conversions. /// </summary> + /// <param name="method">The method to create a delegate for, which must be declared in an IMessage + /// implementation.</param> internal static Func<IMessage, int> CreateFuncIMessageInt32(MethodInfo method) => GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageInt32(method); /// <summary> /// Creates a delegate which will execute the given method after casting the first argument to - /// the target type of the method, and the second argument to the first parameter type of the method. + /// the type that declares the method, and the second argument to the first parameter type of the method. /// </summary> + /// <param name="method">The method to create a delegate for, which must be declared in an IMessage + /// implementation.</param> internal static Action<IMessage, object> CreateActionIMessageObject(MethodInfo method) => GetReflectionHelper(method.DeclaringType, method.GetParameters()[0].ParameterType).CreateActionIMessageObject(method); /// <summary> /// Creates a delegate which will execute the given method after casting the first argument to - /// the target type of the method. + /// type that declares the method. /// </summary> + /// <param name="method">The method to create a delegate for, which must be declared in an IMessage + /// implementation.</param> internal static Action<IMessage> CreateActionIMessage(MethodInfo method) => GetReflectionHelper(method.DeclaringType, typeof(object)).CreateActionIMessage(method); @@ -174,4 +182,4 @@ namespace Google.Protobuf.Reflection // Public to make the reflection simpler. public static SampleEnum SampleEnumMethod() => SampleEnum.X; } -}
\ No newline at end of file +} |