-
Notifications
You must be signed in to change notification settings - Fork 225
Closed
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversion
Description
Input code
Public Class Class1
Public Property SomeProp(ByVal index As Integer) As Single
Get
Return 1.5
End Get
Set(ByVal Value As Single)
End Set
End Property
Public Sub Foo()
Dim someDecimal As Decimal = 123.0
SomeProp(123) = someDecimal
End Sub
End Class
Erroneous output
public class Class1
{
public float get_SomeProp(int index)
{
return 1.5F;
}
public void set_SomeProp(int index, float value)
{
}
public void Foo()
{
decimal someDecimal = 123.0M;
this.set_SomeProp(123, someDecimal);
}
Expected output
AFAICT we just need the explicit cast or some other way of converting to the target type at the call sites of the indexed property setter. I put a cast here, but the right thing may be one of the Conversions calls or something.
public class Class1
{
public float get_SomeProp(int index)
{
return 1.5F;
}
public void set_SomeProp(int index, float value)
{
}
public void Foo()
{
decimal someDecimal = 123.0M;
this.set_SomeProp(123, (float)someDecimal);
}
Details
VS extension 8.1.6.0
GrahamTheCoder
Metadata
Metadata
Assignees
Labels
VB -> C#Specific to VB -> C# conversionSpecific to VB -> C# conversion