I'm trying to convert some code written in VB.NET to C# and am getting this error:
Compiler Error Message: CS0118: 'ASP.filename_aspx.localCart' denotes a 'field' where a 'method' was expected
Here's my code:
for(i = 0; i <= Information.UBound((System.Array)localCart, 2); i += 1)
{
if (Convert.ToString(localCart(CARTID, i)) != "")
{
orderTotal = orderTotal + (Convert.ToDouble(localCart(CARTPPRICE, i)) * Convert.ToDouble(localCart(CARTPQUANTITY, i)));
//do something
}
The error is point to this line: if (Convert.ToString(localCart(CARTID, i)) != "")
Any solutions

error on vb.net to c# conversion
Origamime
andplo
localCart(CARTID, i)
VB uses () for array indexes, and C# uses [ ]. Try localCart[CARTID, i], as it stands, your code is looking for a method called localCart. Which is why it says that localCart is not a method, but your code thinks that it is.