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

Structures should provide default ctors that initialize cbSize members if applicable #1318

Open
siegfriedpammer opened this issue Jan 3, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@siegfriedpammer
Copy link

Some structures have a their size as a first member to allow the Win32 API to support different versions of a struct (for example MONITORINFO vs MONITORINFOEX). In recent versions of C# it is possible to provide a parameterless default constructor, which should be used to initialize the cbSize member to the correct size. This will prevent many subtle bugs.

Examples of such structs are:

  • WINDOWINFO
  • MONITORINFO
  • MONITORINFOEX
@siegfriedpammer siegfriedpammer added the enhancement New feature or request label Jan 3, 2025
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

No branches or pull requests

1 participant