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

Adds an overload to RegisterBeforeDispose() #16322

Merged
merged 6 commits into from
Jun 17, 2024

Conversation

gvkries
Copy link
Contributor

@gvkries gvkries commented Jun 14, 2024

Adds an overload to RegisterBeforeDispose() to allow adding callbacks at the end of the list.

Fixes #16306

@gvkries gvkries changed the title Added a overload to RegisterBeforeDispose() Adds an overload to RegisterBeforeDispose() Jun 14, 2024
internal void BeforeDispose(Func<ShellScope, Task> callback) => (_beforeDispose ??= []).Insert(0, callback);
internal void BeforeDispose(Func<ShellScope, Task> callback, bool last)
{
var list = _beforeDispose ??= [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than a separate collection like I suggested.

Why the new local list though? and not just use _beforeDispose directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just personal habit...

@deanmarcussen
Copy link
Member

Nice, that will do the trick thanks.

@Piedone
Copy link
Member

Piedone commented Jun 17, 2024

Anybody with any further remarks?

@hishamco
Copy link
Member

What about this comment?

@sebastienros
Copy link
Member

@hishamco it's about style ... already spent too much time just asking the question ;)

@Piedone Piedone merged commit 5e90031 into OrchardCMS:main Jun 17, 2024
5 checks passed
@gvkries gvkries deleted the gvkries/shellscope-16306 branch June 18, 2024 09:21
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.

ShellScope RegisterBeforeDispose should support sequential inserts
5 participants