You get this error because myClass.GetHistory(); returns an IEnumerable<URL> , which does not match the List<URL> at compile time, although it is actually a List<URL> at runtime. Change the method signature to return List<URL> because you already do this
public List<URL> GetHistory()
Other workarounds would be to output the result of the method call to List<URL>
List<URL> calledList = (List<URL>)myClass.GetHistory();
Or create a new list from the result
List<URL> calledList = new List<URL>(myClass.GetHistory());
If you do not need list functions, you can define calledList as IEnumerable
var calledList = myClass.GetHistory();
source share