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

Project COM getters and setters as properties #738

Closed
mcooley opened this issue Oct 26, 2022 · 2 comments · Fixed by #739
Closed

Project COM getters and setters as properties #738

mcooley opened this issue Oct 26, 2022 · 2 comments · Fixed by #739
Assignees
Labels
enhancement New feature or request

Comments

@mcooley
Copy link
Member

mcooley commented Oct 26, 2022

Consider APIs like Windows.UI.Accessibility.IUIAutomationElement.get_CachedAcceleratorKey. This should be exposed to .NET developers as a property instead of a method. The get_ prefix should be omitted.

I want this so I can use cswin32 to seamlessly replace interop assemblies generated by tlbimp. This change would also make cswin32 more consistent with the Rust win32 projection (which also omits the get_ prefix) and more consistent with CsWinRT.

The metadata already puts the SpecialName attribute on methods which need this treatment.

@mcooley mcooley added the enhancement New feature or request label Oct 26, 2022
@AArnott
Copy link
Member

AArnott commented Oct 26, 2022

I think this is an excellent suggestion. And we will usually be able to do it. The exception will be when the virtual method table describes the property getter and setter, but not in neighboring rows in the table. In such a case, CSWin32 at best can emit only one of them as a property due to C# language limitations.

@AArnott AArnott self-assigned this Oct 26, 2022
@AArnott
Copy link
Member

AArnott commented Oct 26, 2022

Trivia: IUIAutomationProxyFactoryEntry is an example of an interface that doesn't put the accessors next to each other. As a result, there is no C# representation of the interface where both accessors can be represented on the property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants