Hebrews 10:35-39 (HCSB)
“So don’t throw away your confidence, which has a great reward.
For you need endurance, so that after you have done God’s will, you may receive what was promised.
For in yet a very little while, the Coming One will come and not delay.
But My righteous one will live by faith; and if he draws back, My soul has no pleasure in him.
But we are not those who draw back and are destroyed, but those who have faith and obtain life.”
This blog post will attempt to explain the difference between Static & NonStatic regarding classes & methods in the C# programming language. However, this post will start by diving into a C# class.
What Is A Class?
Classes are “blueprints for creating objects.” This blueprint helps define the object’s structure & behavior. Think of the class as a recipe template. The class recipe can also contain methods.
An object is “basically a block of memory that has been allocated and configured according to the blueprint” that the class created.
Classes are declared using the keyword class.

Classes in C#, are only allowed to utilize single inheritance. Therefore, a class can only inherit from a single base class. A class CAN implement more than one interface.
Classes are internal by default. Classes that are declared directly within a namespace (not nested within other classes) can be either public or internal.
Classes can also be generic. Generic “classes encapsulate operations that are not specific to a particular data type. The most common use for generic classes is with collections like linked lists, hash tables, stacks, queues, trees, and so on.”
For examples of Generic classes & methods, read this documentation.
Classes in C# provide Encapsulation.
Encapsulation is a principle/pillar of object-oriented programming (OOP). The class can limit accessibility to the class’s internal members.
The class encapsulates it’s internal members from the impact of code outside of that class. This is important from a security perspective.
Here is a short program, I created that briefly incorporates encapsulation & access-limiters.
This program shows how using the private access modifer for variable “bank_account_balance” limits how the “public ViewBalance()” method can manipulate the data inside.


Unlike other languages, C# contains no global variables or methods, and therefore, all members are internal to at least one class or struct, even if this process is implicit.
Even the program’s entry point, the Main method, is declared within a class or struct.

Static Class
According to Microsoft Learn, a static class is similar to a non-static class, except that a static class can not be instantiated.
Since a static class can not be instantiated, the new operator cannot be utilized to create a variable of the static class type.
Instead, a static class is initialized with a static constructor.
Static Constructors
A static constructor is called automatically by the common language runtime (CLR). The static constructor runs before any instance constructor will in a non-static class. The static constructor cannot be called directly, and the user has no control over when the static constructor is executed in the program.
An example of a common use for a static constructor is when a class is utilizing a log file and the constructor is used to write entries to the log file.
The main features of a static class are: (1) it contains only static members, (2) it can NOT be instantiated, (3) it is sealed, and (4) it can’t contain Instance Constructors [new].
A static class is called as follows:
// The hypothetical class is PersonClass.
PersonClass.MethodOne();
A static class is often utilized as a container for sets of methods that operate on input parameters without getting/setting any internal instance fields.
Static Class Example:
System.Math
The .NET Class Library has a static class called System.Math that contains methods that perform various mathematical operations. These methods do not require data to be stored or retrieved that is unique to a particular instance of the Math class.
Using the Visual Studio IDE, you can look up the definition for System.Math:
(1) Start with similar code to this test program:

(2) Right-click the “Math” Class name, highlighted in Red in the picture for step (1) above. This will open up a menu, similar to this.

(3) Either Click “Go To Definition” or “F12” when the menu is brought up, after right-clicking on the “Math” class name on the Visual Studio IDE.

(4) The purpose is highlighted in blue, and the static definition is found for the “Math” class highlighted in red.
Non-Static Classes
The non-static class in C#, requires the usage of the new operator to create a variable of the class type.

The class is “Bank_Account“, the object is named “oneAccount”, and the new operator creates the object.
This “oneAccount” object of the class “Bank_Account” can then call & utilize methods from within the “Bank_Account” class. In the image above, the object “oneAccount” is using the method “ViewBalance()” to view their account balance.
Here is the “Bank_Account” class & “ViewBalance()” method code, for anyone interested:

A non-static class CAN contain “static methods, fields, properties, or events.”
Leave a Reply