Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Good practice to put all global/common objects & methods in App class?

$
0
0

Hello!

I was wondering if it is a good practice to keep the globally required objects and methods inside the App class (public sealed partial class App : Application). If yes, should I make these all members static and access them anywhere as App.value=20; App.method();, or should I keep them non-static and use them with an object such as,

app = (App)Application.Current;

app.value=20;

app.method();

I understand both of them works just fine. But which way is a good programming practice, or there's no harm and either is fine?

Thanks!


- Prateek Jain


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>