Skip to content

String.Format and params array #4921

@scottdorman

Description

@scottdorman

The String.Format methods take a params array as an argument which looks like it's been enabled for nullable reference types.

https://github.com/dotnet/runtime/blob/118eee973af81119fd00fe75bc9c14ce3192ff1e/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs#L481-L491

However, in the docs the signature is shown as

public static string Format (string format, params object[]? args);

Is this a docs bug or should the implementation be params object[]? args?

Isn't one ( params object[]? args) effectively "a parameters array of object, where the entire argument could be null) while the other ( params object?[] args) effectively "a parameters array of nullable object, where the argument itself isn't expected to be null"?

Metadata

Metadata

Labels

Pri3Indicates issues/PRs that are low priorityarea-Infrastructuredoc-bugProblem with the content; needs to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions