【问题标题】:.net webservice json modification help object wihing obect.net web 服务 json 修改帮助对象内的对象
【发布时间】:2012-11-03 02:22:59
【问题描述】:

大家好,我已经能够弄清楚如何从 .net 网络服务简单地发送一个类。

这是我的课

Imports Microsoft.VisualBasic

Public Class TestClass

    Public Class Person

        Public Class Names
            'Public Property Firsname As String
            Public Property ID As Integer
            Public Property LastName As String
            Shared Property FirstName As String

        End Class
    End Class
End Class

这是我在我的代码中使用它的方式,

<WebMethod()> _
    Public Function PersonList(ID As Integer) As List(Of Person.Names)
        'Dim p As New Person With {.ID = ID, .FirstName = "Kenneth"}
        Try




            Dim ListPerson As New List(Of Person.Names)



            For startNumber = 1 To 4
                Dim Per As New Person.Names

                Per.ID = startNumber
                ListPerson.Add(Per)
            Next

            Return ListPerson



        Catch ex As Exception

            Dim Per As New Person.Names

            Per.ID = ex.Message

            Dim ListPerson As New List(Of Person.Names)

            ListPerson.Add(Per)



        End Try

    End Function

这在我返回 JSON 时效果很好,但现在我想更进一步。 我想要有列表的列表。这可能吗?

看看这张图片。

我想返回一个低于 id 的数组,而不仅仅是 id 的值。 我该怎么做?

【问题讨论】:

    标签: javascript .net json web-services


    【解决方案1】:

    这里的诀窍是序列化 XML,我需要它来制作我的班级成员之一的字符串列表,该列表完全完成了我想做的事情。 谢谢大家

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-25
      • 1970-01-01
      • 1970-01-01
      • 2011-01-21
      • 2014-10-03
      • 1970-01-01
      相关资源
      最近更新 更多