Home > Net >  c# to vb conversion issues - Is this line correct?
c# to vb conversion issues - Is this line correct?

Time:02-14

I am trying to convert this line to vb.net:

using var scorer = new YoloScorer<YoloCocoP5Model>("Assets/Weights/yolov5s.onnx");

I converted it like this (renaming also scorer to my scorer, and correcting the path):

Dim myscorer As New Yolov5Net.Scorer.YoloScorer(Of Yolov5Net.Scorer.Models.YoloCocoP5Model)("Assets/Weights/best.onnx")

Visual studio is not complaining, so I assume that the conversion is correct, but unfortunately its also not returning anything later in the code, so its not working properly. This line is the only one I am still not sure at the moment. What is the anotation <xxx>(...)?

CodePudding user response:

My first suggestion would be to import Yolov5Net.Scorer and Yolov5Net.Scorer.Models since C# is doing the same indicated by the lack of fully qualified namespaces.

My second suggestion would be to use a Using declaration like what C# is doing:

Using myscorer As New YoloScorer(Of YoloCocoP5Model)("Assets/Weights/best.onnx")
    ' do something with myscorer
End Using
  • Related