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

Use the required keyword instead of String.Empty in options class #34588

Open
Daan5556 opened this issue Jan 29, 2025 · 0 comments
Open

Use the required keyword instead of String.Empty in options class #34588

Daan5556 opened this issue Jan 29, 2025 · 0 comments

Comments

@Daan5556
Copy link

Daan5556 commented Jan 29, 2025

Description

In the PositionOptions class, maybe we want to use the required keyword because it's the more modern syntax.

Example:

public class PositionOptions
{
    public const string Position = "Position";

    public required string Title { get; set; } 
    public required string Name { get; set; } 
}

If you agree, we should also change the other instances of String.Empty.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/configuration/options.md

Document ID

dc7e3449-650b-d117-5eac-69e5ccb250cb

Article author

@tdykstra

Metadata

  • ID: ed39cb0e-aa85-8bba-ffb4-859b56a60723
  • Service: aspnet-core
  • Sub-service: fundamentals

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant