Defining Static Classes
Since the release of .NET 2.0, the C# language expanded the scope of the static keyword by intro-
ducing
static classes. When a class has been defined as static, it is not creatable using the new
keyword, and it can contain only members or fields marked with the static keyword (if this is not
the case, you receive compiler errors).
At first glance, this might seem like a fairly useless feature, given that a class that cannot be cre-
ated does not appear all that helpful. However, if you create a class that contains nothing but static
members and/or constant data, the class has no need to be allocated in the first place. Consider the
following new static class type:
Do'stlaringiz bilan baham: |