I overheard two of my coworkers debating this topic and I was wondering what the general thought is.
Right now in our application we use a lot of key value pairs and they are looking for the best way to implement a solution that would avoid us to remember the spelling for the key.
It is not possible to create instances of a static class. Static classes and class members are used to create data and functions that can be accessed without creating an instance of the class.
Static class always contains static members. Non-static class may contain both static and non-static methods. Static class does not contain an instance constructor.
The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created. Static classes are sealed and therefore cannot be inherited. They cannot inherit from any class except Object.
A resource file generates static class behind the scenes to access those resources so you end up basically with the same thing. It's just that if you use a resource file and one day you decide to localize you are good to go. Of course there is no definite answer to this question. Looks subjective to me as both solutions are perfectly viable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With