There is a record of this type

private struct WindowProperties { public Action WindowDrawDelegate; } dialog.StartModal(entry.Id, DialogHelper.DialogType.AssignElement, new WindowProperties { WindowDrawDelegate = DrawReassignOrRemoveElementAssignmentWindow }, DialogResultCallback); dialog.StartModal(entry.Id, DialogHelper.DialogType.DeleteAssignmentConfirmation, new WindowProperties { WindowDrawDelegate = DrawModalWindow }, DialogResultCallback); 

If there is only one entry in WindowsProperties, can it somehow be simplified?

    1 answer 1

    For example:

     private struct WindowProperties { public Action WindowDrawDelegate; public WindowProperties(Action windowDrawDelegate) { WindowDrawDelegate = windowDrawDelegate; } } dialog.StartModal( entry.Id, DialogHelper.DialogType.AssignElement, new WindowProperties(DrawReassignOrRemoveElementAssignmentWindow), DialogResultCallback); 

    You can also define an implicit operator ActionWindowProperties , but this is probably not very correct (although it will shorten the code).