Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

User32: make MENUITEMINFO.Create() static #458

@x1unix

Description

@x1unix

Hello, currently MENUITEMINFO.Create() is instance method and if I need to create the struct with correct size, I need to do this:

MENUITEMINFO mii = new MENUITEMINFO();
MENUITEMINFO correctMii = mii.Create();

Currently, I don't see any advantage of non-static .Create() because it doesn't utilize original struct's state:

 public MENUITEMINFO Create()
            {
                return new MENUITEMINFO
                {
                    cbSize = Marshal.SizeOf(typeof(MENUITEMINFO))
                };
            }

I think that it will be more convenient to make this method static to avoid mii declaration (or provide alternative way to initialize the struct):

MENUITEMINFO mii = MENUITEMINFO.Create();

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions