Session in WPF?

后端 未结 4 2053
慢半拍i
慢半拍i 2020-12-06 16:29

In ASP.NET, I can do Session[\"something\"] = something;, and then I can retrieve in another page the value of the session. Is there a Session in WPF that would

4条回答
  •  温柔的废话
    2020-12-06 17:22

    In my opinion, the best way to do it will be to store it in the current properties of your application like this :

    Application.Current.Properties["stuff"]
    

    You can store any kind of object, but don't abuse it.

    I will personally use this kind of tricks only if I have no other way to share data (same advice than Grant Winney)

    I prefer using Resources for translation or images and properties for other flag/data just to separate things a little

提交回复
热议问题