Let’s say we want to keep user information after user logged in to application to share its data over multiple classes, what is the best way to do that.
Usually I keep things like this with a property in a static class :
public User CurrentUser { get; set; }
What’s your idea ?
Thanks in advance.
In WPF: Imagine you have a class called
UserInfothat contains all the information needed about the current logged-in user:Then you can retrieve the current user info object anywhere in your application with the following code: