我试着这样做:
IEnumerable<object> ids = new List<string>() { "0001", "0002", "0003" };
Run Code Online (Sandbox Code Playgroud)
它很棒!
但是当我尝试这样做时:
IEnumerable<object> intIds = new List<System.Int32>() { 1, 2, 3 };
Run Code Online (Sandbox Code Playgroud)
Visual Studio告诉我:不能将类型'System.Collections.Generic.List'隐式转换为'System.Collections.Generic.IEnumerable'.存在显式转换(您是否错过了演员?)
这是为什么?
我正在使用 C# 和 MS Access 2010。我需要从数据库中检索表关系,以确定实体之间的关系并在我的 C# 代码中使用它们。我也需要 SQL Server 数据库具有相同的功能。
有没有办法使用 C# 和 .NET 3.0/3.5/4.0 来做到这一点?
珍惜您的时间。
谢谢,马赫什
.net-4.0 ×1
c# ×1
covariance ×1
ienumerable ×1
ms-access ×1
relationship ×1
sql-server ×1
value-type ×1