且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

asmx asp.net Web服务返回多个类wsdl

更新时间:2023-08-31 18:52:16

如果您定义了MyException

If your definition of MyException

Public Class MyException
        inherits System.Exception
    ...
    End Class

那么您就不需要返回自定义异常,只需将其抛出即可.

then you shouldn't need to return the Custom Exception just throw it.

然后您可以定义

Public Function GetOrder(ByVal id As Integer) As Order

    Try
        ...
        Return New Order()
    Catch ex As Exception
        Throw New MyException(ex.Message)
    End Try

End Function

我记得(已经有一段时间了)尝试从Web方法返回多个对象可能非常麻烦

As I recall (and it's been a while) trying to return multiple objects from a web method can prove to be extremely troublesome