Using Water (version 11.0.0.2637), I tried out the menu option Edit => Paste => Paste & convert C# code, and the resulting code doesn’t seem quite right in three areas related to property definitions. This C# code:
private string mString;
public string[] Test
{
get
{
return mString;
}
set
{
mString = value;
}
}
Yields this Mercury code:
Private Dim mString As String
Public Property Test As String()
Return Me.mString
End Get
Set
Me.mString = value
End Set
End Property
The things that look not quite right to me are:
I think it should be just “Private mString as String”, not “Private Dim mString as String”.
It is missing the initial “Get” statement,
Shouldn’t “Set” instead be “Set (value as String)”? (I might be wrong about that, as Mercury might allow this syntax.)
Oh, duh, this is what happens you are trying to create a simple test example and it has already been a long week. Yep, should not have been an array, just a single string.
If so, that is strange syntax to me. Usually it would either be “Private mString as String” or “Dim mString as String” but not “Private Dim mString as String”.
If I type “private dim mstring as string” into VS2019 w/o Mercury, it removes the “dim”.
Yeah, I recalled that it might be optional, but I was thinking it was a Mercury thing, not an optional VB thing. I’m certainly no expert on what is allowable VB.NET syntax - I guess I’ve fallen into a pattern on what works for me, and everything else looks strange to me!
The original code I was converting had lots of properties and most or all of them were missing the starting “Get” (and so it wouldn’t compile), so that’s what made me look closer. Probably if that wasn’t an issue, I wouldn’t have necessarily noticed/mentioned the other differences.