Share via


'foo' is a 'variable' but is used like a 'method'

 

Over the last several months, because of my current project I have had to program in a bunch of different languages.   (The reason for this will become crystal clear early next week).  Basically, I have had to code in C#, VB, and IronPython while at the same time I have been trying learning Haskell and occasionally Ruby - and some Javascript just for fun on the weekends.  To be brutally honest, this is a major pain.

For example, the difference in the syntax for calling indexers between VB and C#

Dim foo As List(Of String) = New List(Of String)

Console.WriteLine(foo[0])]

Will not compile with the error - "Error 18 Identifier expected."

If I use the VB syntax in C#, I get my new favorite error: 'foo' is a 'variable' but is used like a 'method'

Particular annoying is the differences in For Each between C#, VB, and Python - each which has a slightly different syntax.  For some reason this has been tripping me up a lot during live demos. 

Interestingly, the whole curly brace versus END statements versus tabs (python) deal doesn't bother me at all.  Although, this shocked me.

kick it on DotNetKicks.com

Comments

  • Anonymous
    July 28, 2008
    What a useless peice of information, I come here looking for a solution and get... nothing
  • Anonymous
    December 15, 2008
    I second that motion.   This helps me not.  IF anyone has any suggestions to solve, please post, as I have the same issue.
  • Anonymous
    August 21, 2009
    The comment has been removed