Arrays 使用IHttpActionResult将数组发布到web api在VB中不起作用

Arrays 使用IHttpActionResult将数组发布到web api在VB中不起作用,arrays,json,vb.net,post,asp.net-web-api,Arrays,Json,Vb.net,Post,Asp.net Web Api,我可以使用ajax和IHttpActionResult将数组发布到C#.net(VS2017)中的web api。但是,在我将代码转换为vb.net(VC2017)之后,它就不起作用了。我只得到变量的0值。这是我的密码: 类别: Public Class Latlon Public Property latIn As Decimal Public Property lonIn As Decimal End Class API控制器 <HttpPost> Public F

我可以使用ajax和IHttpActionResult将数组发布到C#.net(VS2017)中的web api。但是,在我将代码转换为vb.net(VC2017)之后,它就不起作用了。我只得到变量的0值。这是我的密码:

类别:

Public Class Latlon
   Public Property latIn As Decimal
   Public Property lonIn As Decimal
End Class
API控制器

<HttpPost>
Public Function Post(ByVal latlons As List(Of Latlon)) As IHttpActionResult
    Dim lat1 = latlons(0).latIn
    Return Content(HttpStatusCode.BadRequest, lat1)
End Function
铬F12
您的属性名称不匹配

    var latlon = [
        { lat: 45, lon: -120 },
        { lat: 55, lon: -112 }
    ];
与VB类中的不同

Public Class Latlon
    Public Property latIn As Decimal
    Public Property lonIn As Decimal
End Class
尝试重命名vb类中的属性

Public Class Latlon
    Public Property lat As Decimal
    Public Property lon As Decimal
End Class

您的属性名称不匹配

    var latlon = [
        { lat: 45, lon: -120 },
        { lat: 55, lon: -112 }
    ];
与VB类中的不同

Public Class Latlon
    Public Property latIn As Decimal
    Public Property lonIn As Decimal
End Class
尝试重命名vb类中的属性

Public Class Latlon
    Public Property lat As Decimal
    Public Property lon As Decimal
End Class

非常感谢你,肯!你帮我节省了很多时间。转换之后,我更改了变量名,这导致了问题。我没有意识到这一点。新年快乐!非常感谢你,肯!你帮我节省了很多时间。转换之后,我更改了变量名,这导致了问题。我没有意识到这一点。新年快乐!