65.9K
CodeProject is changing. Read more.
Home

Passing Enum type as a parameter

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Aug 24, 2011

CPOL
viewsIcon

5820

I think the compile time force for a little enum enforcement would look something like this... (excuse the bad syntax, doing it from memory)private T GetPreviousEnum(this T currentlySelectedEnum) where T: structStackOverflow has a good question and answer in relation to it here.[^].

I think the compile time force for a little enum enforcement would look something like this... (excuse the bad syntax, doing it from memory)

private T GetPreviousEnum<T>(this T currentlySelectedEnum) where T: struct

StackOverflow has a good question and answer in relation to it here.[^].