Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# string enum

public static class Status
{
    public const string Awesome = "Awesome";
    public const string Cool = "Cool";
}
//Not an enum but has a similar effect without needing to convert ints
Comment

c# string enum

public class LogCategory
{
    private LogCategory(string value) { Value = value; }

    public string Value { get; set; }

    public static LogCategory Trace   { get { return new LogCategory("Trace"); } }
    public static LogCategory Debug   { get { return new LogCategory("Debug"); } }
    public static LogCategory Info    { get { return new LogCategory("Info"); } }
    public static LogCategory Warning { get { return new LogCategory("Warning"); } }
    public static LogCategory Error   { get { return new LogCategory("Error"); } }
}
Comment

c# string enum


public class LogCategory
{
    private LogCategory(string value) { Value = value; }

    public string Value { get; private set; }

    public static LogCategory Trace   { get { return new LogCategory("Trace"); } }
    public static LogCategory Debug   { get { return new LogCategory("Debug"); } }
    public static LogCategory Info    { get { return new LogCategory("Info"); } }
    public static LogCategory Warning { get { return new LogCategory("Warning"); } }
    public static LogCategory Error   { get { return new LogCategory("Error"); } }
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: find how many digits a number has 
Csharp :: how to check type c# 
Csharp :: add a dictionary to another dictionary c# 
Csharp :: on collision enter by layer 2d unity 
Csharp :: unity check if camera can see object 
Csharp :: c# replace dash in string 
Csharp :: c# return 2 values 
Csharp :: c# list foreach 
Csharp :: ternary operator c# 
Csharp :: Long, Max and Min value 
Csharp :: bundle.config in mvc is missing 
Csharp :: c# get property type of list 
Csharp :: methods c# 
Csharp :: if debug c# 
Csharp :: c# csvhelper 
Csharp :: how to create public variable in c# 
Csharp :: c# #region #endregion 
Csharp :: append 2 arrays c# 
Csharp :: c# create excel file 
Csharp :: ray casting unity 
Csharp :: meaning of ??= in c# 
Csharp :: c# funtion 
Csharp :: c# scroll to bottom of datagridview vb.net 
Csharp :: how to remove all comma from string c# 
Csharp :: c# string right extension 
Csharp :: switch statement c# example 
Csharp :: unity lerp 
Csharp :: same click event diffrenet buttonms c# 
Csharp :: longest substring without repeating characters c# 
Csharp :: serilog .net 6 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =