获取错误消息“Can not implicity convert type system.Collections.Generic.List to List” [英] Getting error message "Cannot implicity convert type system.Collections.Generic.List to List"

查看:92
本文介绍了获取错误消息“Can not implicity convert type system.Collections.Generic.List to List”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用一种方法:

I am calling a method:

lstMessages = UserDetailsService.GetMessagesForUser((thisUserID.Id).ToString()).ToList();



虽然在左边单步执行没有 lstMessages 的代码但它工作正常但是当我将其设置为相等时我得到了错误。



Generics的新内容。



为什么我会收到此错误?


While stepping through the code without the lstMessages on the left it works fine, but when I set it to equal I get the error.

Kind of new to Generics.

Why am I getting this error?

推荐答案

错误信息很简单



它不能从右边的类型转换为键入左侧。



lstMessages的类型应该是右侧函数返回(这是一个通用列表)。
The error message is pretty straightforward

It can''t convert from the type on the right, to the type on the left.

The type of lstMessages should be as the right hand side functions return (which is a Generic List).


这篇关于获取错误消息“Can not implicity convert type system.Collections.Generic.List to List”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆