Hi,

I am playing with webservice to return complex objects and am not able to
return value of Public method. Can you tell me what i am doing wrong?

My Webservice:

    <WebMethod()> Public Function getsum() As Class1
        Return New Class1(10, 20)
    End Function

Class1.vb:

Option Strict On
Public Class Class1
    Private a_ As Integer
    Private b_ As Integer

    Public Sub New()
        Me.New(0, 0)
    End Sub

    Public Sub New(ByVal c As Integer, ByVal d As Integer)
        Me.a = c
        Me.b = d
    End Sub

    Public Function sum() As Integer
        Return a + b
    End Function

    Public Property a() As Integer
        Get
            Return a_
        End Get
        Set(ByVal Value As Integer)
            a_ = Value
        End Set
    End Property
    Public Property b() As Integer
        Get
            Return b_
        End Get
        Set(ByVal Value As Integer)
            b_ = Value
        End Set
    End Property
End Class

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to