示例#1
0
        public static KeyValuePair <int, string>[] AsLookup()
        {
            var roles = new UserRoleEnum[]
            {
                UserRoleEnum.Admin,
                UserRoleEnum.Editor,
                UserRoleEnum.Viewer
            };

            return
                (roles
                 .Select(role => new KeyValuePair <int, string>(Convert.ToInt32(role), role.ToString()))
                 .ToArray());
        }