I am a VB.Net programmer <ducks> trying to convert to c#.net

I'm tryting to write this in VB

`

for each oRow as datarow in Mytable.rows
    debug.print oRow("Subs_City")
next

`
What I've come up to until now, but it's won't compile is this;

           DataColumn colCity = o.oDt.Columns["Subs_City"];
            foreach (DataRow oRow in o.oDt.Rows)
            {
                Debug.Print(oRow[colCity].ToString);
            }

The compile errors are :

Error 1 The best overloaded method match for 'System.Diagnostics.Debug.Print(string)' has some invalid arguments
Error 2 Argument 1: cannot convert from 'method group' to 'string'

I needed to cast ...

Debug.Print((string)oRow["Subs_City"])

seems to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.