none
Error_CS0021_Cannot apply indexing with [] to an expression of type 'var.VarDelegate'_ RRS feed

  • Question

  • I am using Visual Studio with GIT.  I checked out the projects the way the others on the team have done.  The project uses TestComplete to connect to an IE page which, for some reason, can't be accessed by Selenium.  Anyway, everyone else is able to build, but I get the message in the subject:

                               

          Error CS0021 Cannot apply indexing with [] to an expression of type 'var.VarDelegate'

    This happens in many locations.

             return obj[firstPropertyName][secondPropertyName].UnWrap();                                                                                                                                                                                                                                                                                           The declaration is "var obj" and is located in AutomatedQA.script.var                                                                                                                                                                                                                                                                               everything is the same as the others in the team, except I have a new Windows 10 laptop which has Visual Studio 2015 on it, while the others have 2012, but I imagine it should be upwardly compatible.  If I did not mention it above, this is Visual Studio (2015) with Test Complete 12.10.                                                                                                                                                                                                                                                                                                              Any help would be appreciated.  Sorry for the formatting, but it will not allow me to enter new lines.

    Monday, May 13, 2019 3:03 PM

All replies

  • Make sure that you have the right version of third-party product. Maybe you should ask for support the product's owner.

     

    According to some samples, perhaps you have to write ‘obj[firstPropertyName](secondPropertyName)’.

    Tuesday, May 14, 2019 5:08 AM
  • A lot of other people use this code too, so I can't change it.  I think I may need to use 2012.

    On another note, does anyone have experience with "Test Left"?

    Tuesday, May 14, 2019 12:00 PM
  • Is this a Selenium question? Is the actual type of `obj` a Selenium object? If so then please post in their forums. They can better guide you on this issue. 

    For Test Complete you'll need to post in their support forum. This forum is for C#-specific questions. MSDN forums are, in general, for MS products only. Third party product questions should be posted in their forums.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, May 14, 2019 2:13 PM
    Moderator