gpt4 book ai didi

c# - AnonymousType0#1`6 中的 # 符号是什么意思?

转载 作者:太空宇宙 更新时间:2023-11-03 14:44:47 24 4
gpt4 key购买 nike

正如您在下面的错误行中看到的,两个 AnonymousType0 文本除了 # 符号外几乎相同。 # 符号是什么意思?

(重新格式化错误以使其更易于阅读)

Unable to cast object of type

'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[
<>f__AnonymousType0#1`6[System.String,System.String,System.String,
System.Int32,System.Decimal,System.Double]]'

to type

'System.Linq.IQueryable`1[
<>f__AnonymousType0`6[System.String,System.String,System.String,
System.Int32,System.Decimal,System.Double]]'

最佳答案

从这两个问题来看

Casting errors when attempting to return an IQueryable<MyType>

Combine two EF Queries, Unable to cast object of type System.Data.Entity.Infrastructure.DbQuery to System.Collections.Generic.IEnumerable

您可能无法转换,因为您的匿名类型彼此不完全匹配(因此 #1 可能表明这不是同一类型)。

尝试检查两种类型是否具有完全相同的属性集(相同的类型和相同的名称;没有在一种类型中声明但在另一种类型中声明的额外属性)。

祝你好运!

关于c# - AnonymousType0#1`6 中的 # 符号是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54974279/

24 4 0