string.IsNullOrEmpty() vs. String.IsNullOrEmpty()
When we specify String.IsNullOrEmpty() in our code, Visual Studio recommends that we lowercase the 'S' - hence string.IsNullOrEmpty().
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
I am unable to add a Documentation area label.
For some background see string vs. String is not a style debate.
Does your concern belong to an url in the docs? If so, can you please point to that url, so an action could be taken here.
Thanks, @gfoidl.
https://learn.microsoft.com/en-us/dotnet/api/system.string.isnullorempty?view=net-8.0 indicates that we should call String.IsNullorEmpty(); in response, it should indicate that we should call string.IsNullorEmpty() instead.
IMO the docs are correct, as that's a method of System.String type which is unambiguous.
Similar to other members of that type.
In your user code due to the using System the identifier String isn't unambiguous (see blog post), thus the keyword string should be used. This doesn't apply to the API docs though.
Besides that String <-> string is a C# concern, not pure API docs.
But I don't say that there could be some indication to use string on all string members (and similar to object, etc.) if there's a good way to do so w/o bloating the API docs (maybe this belongs to C# docs?).
I'm always up for any (additional) information to help us.
Tagging subscribers to this area: @dotnet/area-system-runtime
This doesn't apply to the API docs though
While it is less ambiguous for the docs, it would still be generally good if docs were consistent with the default/recommended styling considerations as most readers will view them as code they could/should write themselves, not as something that is specific to the type it's written for.
CC. @gewarren, is there an easy way to audit the doc examples and ensure that for C# we're using the keyword (string, int, long, etc) rather than the type name (String, Int32, Int64, etc)?
Seems like there should be an easy way, what with AI. I've assigned this issue to myself for next month.
Related to dotnet/docs#41315.