Forum Discussion

mithileshmaurya's avatar
mithileshmaurya
Occasional Contributor
10 years ago
Solved

not able to cast Var.delegate to var object

Hello,



one of my C# code  i have below code:




Browserparent = Connect.Aliases["browser"]["pagePreDealChecking"];



FrameParent = Browserparent["frameMainframe"]["frameExposures"];



var availabilityparent = FrameParent["Table_Availability"];



which is working fine, that is, I get an object in availabilityparent  , but it is of type var.delegate.



Question: How can i get the rowcount of the availabilityparent ?

code im using :

var temp = new var((availabilityparent["RowCount"]));



(after compiling this code I get the error:

Error 1 The call is ambiguous between the following methods or properties: 'AutomatedQA.script.var.var(short)' and 'AutomatedQA.script.var.var(string)'



how do I get the integer row count?



Please help


  • This should work:

    int rowCount = (int) availabilityparent["RowCount"];

3 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    This should work:

    int rowCount = (int) availabilityparent["RowCount"];
  • mithileshmaurya's avatar
    mithileshmaurya
    Occasional Contributor
    the solution mentioned by you works perfectly functionality wise , but still for this line I get an error from my resharper saying that :

    "Cannot cast expression of type "AutomatedQA.script.var.varDelegate" to type "int".



    It is version 6.1