I have the following enum:
public enum UserRole {
Admin = 1,
Leader = 2,
Editor = 3,
Guest = 4
} // UserRole
And the following list:
IList<UserRole> roles = new List<UserRole> { UserRole.Leader, UserRole.Editor };
I would like to create two new lists:
1 – A list that picks the lowest index item in roles, eg, UserRole.Leader = 2 and all the UserRoles higher than that one. So I would get:
UserRole.Leader, UserRole.Editor, UserRole.Guest
2 – A list that picks the highest index item in roles, eg, UserRole.Editor = 3 and all the UserRoles lower than that one. So I would get:
UserRole.Admin, UserRole.Leader, UserRole.Editor
How can I do this?
Thank You,
Miguel
How about