Why should I create an open class with all the static properties?

I will notice in the current code base, I work with the fact that the previous developer has a couple of public classes that are not inherited from any other classes, but are filled with static properties. Is this another way to create a structure or enumeration? Is this an older or newer method of storing static data that can be referenced? It seems strange / excellent to me to see a class constructed in this way, but I wonder what the Qaru community feels is trying to make this encoder.

EDITED add example

public class Deal { public Deal() { } public static decimal Fee { get { return (decimal)25; } } public static decimal MaximumAmount { get ( return (decimal)300; } } } 
+4
source share
1 answer

An open class with only static properties is essentially a container for global variables.

It may be a poor design, but there are also good reasons for such a design.

For example, the System.Web.HttpRuntime class is a container for global information about a web application and the System.Windows.Forms.Application class is a container for global information about a WinForms application. The System.Environment class is a container for information about the current environment and platform.

+1
source

Source: https://habr.com/ru/post/1486253/


All Articles