+ 3
Static C#
What is the âstaticâ keyword in C#, in simple words if possible?
2 Answers
+ 2
static makes so you can access variable or method through other classes
For example if you need to change string that is assigned in main class but you want to change in other class you will need to make string static
In Program.cs:
public static string x;
In Class1.cs:
Program.x = "some text";