Re: Visual C# Express Edition month name converting problem
ECasabuena
I think the solution to your problem is by using an enumerated type known as enum
here is an example program:
1. create a class
using System;
using System.Collections.Generic;
using System.Text;
namespace Enum
{
public class Sample
{
//private field
private Months month = Months.January; // set the default value;
//public field
public Months MonthValue
{
get { return month; }
set { month = value; }
}
}
public enum Months : int
{
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12,
}
}
2. Main Program
using System;
using System.Collections.Generic;
using System.Text;
namespace Enum
{
class Program
{
static void Main(string[] args)
{
int value = 6;
Console.WriteLine((Months)(value)); // do a cast
Console.ReadLine(); // the output of this is June
}
}
}
Hope this would help.