Answers for "enum get value"

C#
1

Get the value of an Enum c#

public enum Vehicle: byte
{
    Car,
    Bike=3,
    Truck,
    Taxi,
}

Console.WriteLine((int)VehicleEnum.Car);
string vehicle = Vehicle.Bike.ToString();
Console.WriteLine(vehicle);

Output:
0
Bike
Posted by: Guest on November-03-2021
0

c# get value of object in enum

arrayName variable = (arrayName) index
//for example
Days day = (Days)3;
Posted by: Guest on May-17-2020

C# Answers by Framework

Browse Popular Code Answers by Language