Skip to content

Commit 52b1ccb

Browse files
committed
ParameterInfo.GetIndexParameters() always returns an array, only need the length check
Just removing some overhead here
1 parent ad48bed commit 52b1ccb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Dapper/CommandDefinition.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ private static Action<IDbCommand> GetInit(Type commandType)
182182
private static MethodInfo GetBasicPropertySetter(Type declaringType, string name, Type expectedType)
183183
{
184184
var prop = declaringType.GetProperty(name, BindingFlags.Public | BindingFlags.Instance);
185-
ParameterInfo[] indexers;
186-
if (prop != null && prop.CanWrite && prop.PropertyType == expectedType
187-
&& ((indexers = prop.GetIndexParameters()) == null || indexers.Length == 0))
185+
if (prop != null && prop.CanWrite && prop.PropertyType == expectedType && prop.GetIndexParameters().Length == 0)
188186
{
189187
return prop.GetSetMethod();
190188
}

0 commit comments

Comments
 (0)