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 auto-property instead of expression-bodied syntax #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ArminShoeibi
Copy link

Hey there,

In the MyMetricsRegistry class, there are two properties named Errors and Errors2 that define instances of the GaugeOptions class. While both properties serve the same purpose, they have slightly different behavior, which may not be immediately clear to developers who are new to the codebase.

Errors property returns a single instance of GaugeOptions, whereas Errors2 creates a new instance of GaugeOptions every time it is accessed.

public static class MyMetricsRegistry
{
    public static GaugeOptions Errors { get; } = new GaugeOptions
    {
        Name = "Errors"
    };

    public static GaugeOptions Errors2 => new GaugeOptions
    {
        Name = "Errors2"
    };
}

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.

1 participant