String of enumeration

  • Thread starter Thread starter MAF
  • Start date Start date
M

MAF

How do I return the translation of an enumartion?

public enum PeriodType

{

Year,

CYear,

Season,

Month,

Week,

Hour

}



I want to pass in 0 and get Year back.
 
You want to get the string version "Year", right?

string period = Enum.GetName(
typeof( PeriodType ), (PeriodType) 0 );

-c
 
Back
Top