Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common parts extracted + more changes for #984 #987

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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