Skip to content

Conversation

@n9
Copy link

@n9 n9 commented Sep 27, 2024

Common parts from ReadablePropertiesTypeInspector and WritablePropertiesTypeInspector are extracted to PropertiesTypeInspector and more changes to support #984:

  • virtual method PropertiesTypeInspector.CreateProperty
  • public property ReflectionPropertyDescriptor.PropertyInfo

…and WritablePropertiesTypeInspector

+ add virtual method CreateProperty to PropertiesTypeInspector and PropertyInfo to ReflectionPropertyDescriptor for aaubry#984
@n9
Copy link
Author

n9 commented Sep 27, 2024

PS: During the refactoring I found that the type inspectors might need more refactoring:

The ReadableAndWritablePropertiesTypeInspector only checks if properties are writable, but despite its name it does not check if they are readable.

public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object? container)
{
return innerTypeDescriptor.GetProperties(type, container)
.Where(p => p.CanWrite);
}

Maybe it should be renamed to something like WritablePropertiesTypeInspectorFilter? (But that would be a breaking change.)

Do you want to create an issue for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant