Answers for "c# create global variable in class"

C#
3

how to make a global string c#

public static class Globals
{
    public const Int32 BUFFER_SIZE = 512; // Unmodifiable
    public static String FILE_NAME = "Output.txt"; // Modifiable
    public static readonly String CODE_PREFIX = "US-"; // Unmodifiable
}

String code = Globals.CODE_PREFIX + value.ToString();
Posted by: Guest on December-31-2020
0

how to create public variable in c#

public static class Myvariables{

    public static int x = 1;

}
Posted by: Guest on March-20-2020

C# Answers by Framework

Browse Popular Code Answers by Language