سلام امروز کد استفاده از Enum در سی شارپ C#.NET رو براتون آماده کرده ام.
//the following code describe , if you want to print the value of a enum then you should cast that enum value
using System;
enum Role
{
Admin = 1221,
Manager = 1222
}
public class Program
{
public static void Main()
{
Console.WriteLine(Role.Manager);// Printing Manager
Console.WriteLine((int)Role.Manager); //Printing Manager Value
}
}
using System;
enum Role
{
Admin = 1221,
Manager = 1222
}
public class Program
{
public static void Main()
{
Console.WriteLine(Role.Manager);// Printing Manager
Console.WriteLine((int)Role.Manager); //Printing Manager Value
}
}
موفق و پیروز باشید
یا علی