Asked by:
Convert C# class to vb.net

Question
-
User-583701291 posted
Hello everyone,
Need help converting this C# class to vb.net
public class Proximity
{
public string Name { get; set; }
public string bufferDist { get; set; }
public bool prop_intersect { get; set; }
public featureResult feat { get; set; }
}Thanks
Thursday, August 8, 2019 6:30 PM
All replies
-
User2053451246 posted
Hello everyone,
Need help converting this C# class to vb.net
public class Proximity
{
public string Name { get; set; }
public string bufferDist { get; set; }
public bool prop_intersect { get; set; }
public featureResult feat { get; set; }
}Thanks
Public Class Proximity Public Property Name As String Public Property bufferDist As String Public Property prop_intersect As Boolean Public Property feat As featureResult End Class
Thursday, August 8, 2019 6:34 PM -
User-583701291 posted
I saw this conversion but it does not work.
Should it be something like?
Private _Name As String
Public Property Name As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Thursday, August 8, 2019 6:44 PM -
User-583701291 posted
I am having problems with the last property
Private _feat As featureResult
will you convert it in VB.net like that?
Private _feat As featureResult
Public Property feat As featureResult OR Public Property feat As New featureResult
Get
Return _feat
End Get
Set(ByVal value As featureResult)
_feat = value
End Set
End Property
Thursday, August 8, 2019 6:55 PM -
User2053451246 posted
It says As featureResult, so featureResult must be another class somewhere.
Thursday, August 8, 2019 7:04 PM -
User-583701291 posted
Yes featureResult is another class.
Wahtis the correct way to write this property?
Private _feat As featureResult or Private _feat As New featureResult
Thursday, August 8, 2019 7:07 PM -
User2053451246 posted
I DO NOT think you would use "New".
Thursday, August 8, 2019 7:39 PM -
User303363814 posted
it does not work.Can you add a little detail to this?It doesn't compile? (In which case show us the exact code you used)
It throws a runtime exception? (In which case show us your exact code, the inputs you provided and all details of the Exception)
You don't get the answer you expect? (In which case show us your exact code, the inputs you provide, the actual result, the expected result and the reason why you expected that result)
Friday, August 9, 2019 3:48 AM -
User931645997 posted
Hello dear, it didn't work for me that you provided code.
Saturday, January 23, 2021 5:19 PM