Lets say I got the extension which does something with the enum and then just returns it.
public static T Do<T>(this Enum e) where T : struct
{
// Do something.
return // e? .. (T)e? .. or (T)(object)e? ;
}
So what should I return to let my code be successefully built and run with this example:
Roles role = Roles.Admin | Roles.Moderator;
role.Do<Roles>().SomethingElse().AndMore<Roles>().Etc<int>();
__
return (T)e;
http://pasteboard.s3.amazonaws.com/images/1349685696025173.png
__
return e;
http://pasteboard.s3.amazonaws.com/images/1349685753912110.png
__
return (T)(object)e;
Actually works, but does boxing and then unboxing.