Skip to content

Fix NpgsqlParameterCollection.Add(object) documentation (#6150) - #6179

Closed
Nonanti wants to merge 1 commit into
npgsql:mainfrom
Nonanti:fix/parameter-collection-docs
Closed

Nonanti wants to merge 1 commit into
npgsql:mainfrom
Nonanti:fix/parameter-collection-docs

Conversation

@Nonanti

@Nonanti Nonanti commented Aug 20, 2025

Copy link
Copy Markdown

Added proper XML documentation for the Add(object) method to clearly describe its behavior - that it adds the parameter to the collection and returns the zero-based index of the newly added parameter.

Added proper XML documentation for the Add(object) method to clearly describe its behavior - that it adds the parameter to the collection and returns the zero-based index of the newly added parameter.
@Nonanti
Nonanti requested review from roji and vonzshik as code owners August 20, 2025 02:01

@roji roji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I personally don't think there's much value in this doc change - anyone accidentally passing in a non-NpgsqlParameter gets a very clear InvalidCastException, corrects their code and then never hits this again. So it's one of those cases where it's somewhat academic.

But see below for concrete suggestions.

=> IndexOf(Cast(value));

/// <inheritdoc />
/// <summary>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we want to make this change for Add, we should also do it for the other functions here which accept object and throw if it's not an NpgsqlParameter.

Also, I'd tweak the message to make it clear that although the function accepts object, it throws if a non-NpgsqlParameter is passed in (rather than "Adds the specified NpgsqlParameter...", which doesn't make that very clear).

@NinoFloris

Copy link
Copy Markdown
Member

@Nonanti are you still interested in adding the docs to the other methods?

@NinoFloris

Copy link
Copy Markdown
Member

Closing due to being superseded by #6342

@NinoFloris NinoFloris closed this Jan 2, 2026
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.

3 participants