part.IndexerName = indexerName;
#if NETSTANDARD2_0
- try {
+ try
+ {
property = sourceType.GetDeclaredProperty(indexerName);
}
- catch (AmbiguousMatchException) {
+ catch (AmbiguousMatchException)
+ {
// Get most derived instance of property
- foreach (var p in sourceType.GetProperties().Where(prop => prop.Name == indexerName)) {
+ foreach (var p in sourceType.GetProperties().Where(prop => prop.Name == indexerName))
+ {
if (property == null || property.DeclaringType.IsAssignableFrom(property.DeclaringType))
property = p;
}
}
if (property.CanWrite && property.SetMethod != null)
{
- if(property.SetMethod.IsPublic && !property.SetMethod.IsStatic)
+ if (property.SetMethod.IsPublic && !property.SetMethod.IsStatic)
{
part.LastSetter = property.SetMethod;
part.SetterType = part.LastSetter.GetParameters().Last().ParameterType;