Skip to content

Bring back the Singleton<T>? #4108

Discussion options

You must be logged in to vote

@OneFingerCodingWarrior as the issue on why we removed Singleton states to achieve this with C#, you just need to do this:

public static MyClass Instance { get; } = new();

That's it. That's why we removed the class as it's trivial to do now. We updated our code in the Toolkit to do this. I believe we had a deprecation message mentioning this as well.

FYI @Sergio0694

(Also, please don't paste an excerpt of copyrighted material in full, I've deleted your 2nd comment.)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Sergio0694
Comment options

@OneFingerCodingWarrior
Comment options

Answer selected by michael-hawker
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants