P
Peter K
Hi,
I have a method in a class:
public void AddUserList(List<IUser> users)
{
...
}
which adds a list of users to the class.
I also have a user class:
public class User : IUser
{
...
}
Why is it I cannot perform a call like this:
List<User> users = new List<User>();
AddUserList(users);
I would have naively thought that as User implements IUser, I could pass a
list of User objects to a method which expects a list of IUser objects (as
a User is an IUser).
Thanks,
Peter
I have a method in a class:
public void AddUserList(List<IUser> users)
{
...
}
which adds a list of users to the class.
I also have a user class:
public class User : IUser
{
...
}
Why is it I cannot perform a call like this:
List<User> users = new List<User>();
AddUserList(users);
I would have naively thought that as User implements IUser, I could pass a
list of User objects to a method which expects a list of IUser objects (as
a User is an IUser).
Thanks,
Peter