troubleshooting Question

Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<IRole>'

Avatar of dba123
dba123 asked on
6 Comments1 Solution4449 ViewsLast Modified:
We have this class defined:

namespace VU.Business.Entities
    public class KuDbRoleProvider : IRoleProvider
        public KuDbRoleProvider();

        public IEnumerable<IRole> GetDefaultRoles();
        public IRole GetRoleByName(string roleName);
        public IRole New(string roleName);
        public IEnumerable<IRole> RetrieveAllRoles();

And in another class I'm trying to implement and call the RetrieveAllRoles() and put it into some sort of collection which I tried making an array:

    class KURoleProvider : RoleProviderBase
        public override Configuration.Roles.Role[] GetRoles()
            KuDbRoleProvider roleProvider;
            BusinessInterfaces.Security.IRole[] kuRoles;
            kuRoles = roleProvider.RetrieveAllRoles();

I can't figure out how to get this working.  Here is my error:

 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<BusinessInterfaces.Security.IRole>' to 'BusinessInterfaces.Security.IRole'. An explicit conversion exists (are you missing a cast?)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros