在我的代碼,我有這樣的:我需要施放和枚舉,我該怎麼做?
var wordForm = new WordForm()
{
WordId = word.WordId,
Definition = webWordForm.definition,
SourceId = webWordForm.sourceId,
StatusId = EStatus.Download,
PosId = WordToPosId(webWordForm.partOfSpeech)
};
我聲明瞭枚舉:
public enum EStatus {
NotSet = 0,
New = 1,
Download = 2,
Edited = 3
}
和statusID:
public int StatusId { get; set; } // StatusId
我需要施放此爲int,如果那我該怎麼做?
(int)EStatus.Download或Convert.ToInt32(EStatus.Download) –
什麼是WordForm.StatusId的類型? – fahadash
可能重複的[從枚舉獲取int值](http://stackoverflow.com/questions/943398/get-int-value-from-enum) –