Click here to Skip to main content
15,867,308 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Passing Enum type as a parameter

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
24 Aug 2011CPOL 5.7K  
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)


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

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Stackify
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --