Reporter | Vladimir Reshetnikov (nikov) |
---|---|
Created | Oct 8, 2009 1:36:22 PM |
Updated | Dec 12, 2011 11:58:26 AM |
Priority | Critical |
Type | Bug |
Fix versions | 6.1 |
State | Open |
Assignee | Alexey Kuptsov (alexey.kuptsov) |
Subsystem | No subsystem |
Affected versions | No Affected versions |
Fixed in build | No Fixed in build |
using System.Data; using System.Text; class A { public static string Foo(DataSet ds) { var message = new StringBuilder(); for (var i = 0; i < ds.Tables[0].Rows.Count; i++) message.Append(ds.Tables[0].Rows[i]["message"]); return message.ToString(); } }
Actual result:
public static string Foo(DataSet ds) { var message = new StringBuilder(); foreach (object t in ds.Tables[0].Rows) message.Append(t["message"]); // error CS0021: Cannot apply indexing with [] to an expression of type 'object' return message.ToString(); }
Expected result:
public static string Foo(DataSet ds) { var message = new StringBuilder(); foreach (DataRow row in ds.Tables[0].Rows) message.Append(row["message"]); return message.ToString(); }
Also, strange name 't' for iteration variable is selected and is not editable.