我正在重写/转换一些 VB 代码:
Dim dt As New System.Data.DataTable()
Dim dr As System.Data.DataRow = dt.NewRow()
Dim item = dr.Item("myItem")
C#:
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRow dr = dt.NewRow();
var item = dr.Item["myItem"];
我不能让它在 C# 下运行,我遇到的问题是第三行var item = dr.Item["myItem"];
:
System.Data.DataRow' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Data.DataRow' could be found (are you missing a using directive or an assembly reference?)
System.Data
我在两个项目中都引用了第 4 版。我在这里想念什么?注意:ItemArray 存在于...