Author: jbevain
Date: 2008-01-22 05:59:22 -0500 (Tue, 22 Jan 2008)
New Revision: 93503

Modified:
   trunk/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs
Log:
small refactoring

Modified: 
trunk/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs
===================================================================
--- trunk/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs     
2008-01-22 10:42:47 UTC (rev 93502)
+++ trunk/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs     
2008-01-22 10:59:22 UTC (rev 93503)
@@ -116,22 +116,14 @@
                internal LambdaExpression (Type delegateType, Expression body, 
ReadOnlyCollection<ParameterExpression> parameters)
                        : base (ExpressionType.Lambda, body.Type)
                {
-                       if (!delegateType.IsSubclassOf (typeof 
(System.Delegate))){
+                       if (!delegateType.IsSubclassOf (typeof 
(System.Delegate)))
                                throw new ArgumentException ("delegateType");
-                       }
-                       
-                       MethodInfo [] invokes = delegateType.GetMethods 
(BindingFlags.Instance | BindingFlags.Public);
-                       MethodInfo invoke = null;
-                       foreach (MethodInfo m in invokes){
-                               if (m.Name == "Invoke"){
-                                       invoke = m;
-                                       break;
-                               }
-                       }
+
+                       var invoke = delegateType.GetMethod ("Invoke", 
BindingFlags.Instance | BindingFlags.Public);
                        if (invoke == null)
                                throw new ArgumentException ("delegate must 
contain an Invoke method", "delegateType");
 
-                       ParameterInfo [] invoke_parameters = 
invoke.GetParameters ();
+                       var invoke_parameters = invoke.GetParameters ();
                        if (invoke_parameters.Length != parameters.Count)
                                throw new ArgumentException ("Different number 
of arguments in delegate {0}", "delegateType");
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to