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

Fixes incorrect cast of parameters in CommandBuilder #3015

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

gehongyan
Copy link
Contributor

Description

In CommandBuidler, the AddParameters expects an array of TParamBuidler.

/// <summary>
/// Adds parameter builders to <see cref="Parameters"/>.
/// </summary>
/// <param name="parameters">New parameter builders to be added to <see cref="Parameters"/>.</param>
/// <returns>
/// The builder instance.
/// </returns>
public TBuilder AddParameters(params TParamBuilder[] parameters)
{
_parameters.AddRange(parameters);
return Instance;
}

In the explicit implementation of ICommandBuilder.AddParameters, the parameters of type IParameterBuilder[] should be cast to TParamBuilder[] array instead of a single TParamBuilder.

/// <inheritdoc/>
ICommandBuilder ICommandBuilder.AddParameters(params IParameterBuilder[] parameters) =>
AddParameters(parameters as TParamBuilder);

@Misha-133 Misha-133 enabled auto-merge (squash) December 5, 2024 06:09
@Misha-133 Misha-133 merged commit aaa8df9 into discord-net:dev Dec 5, 2024
2 checks passed
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.

2 participants