有效的 ASP.NET Webmethod 返回类型有哪些?

发布于 2024-07-08 21:56:29 字数 51 浏览 6 评论 0原文

我的 webmethod 只能返回像我在所有 asp.net 站点示例中看到的字符串吗?

Can my webmethod only return strings like I see in all the asp.net site examples?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

似狗非友 2024-07-15 21:56:29

asp.net Webmethods 可以返回任何可序列化的数据类型。

asp.net Webmethods can return any serializable data type.

两个我 2024-07-15 21:56:29

假设此问题与旧版 ASMX Web 服务技术有关,请参阅 使用 ASP.NET 创建的 XML Web 服务支持的数据类型

一定要注意它说的地方:

本主题特定于旧技术。 现在应使用 Windows Communication Foundation (WCF).


Assuming that this question is about the legacy ASMX web service technology, see Data Types Supported by XML Web Services Created Using ASP.NET.

Be sure to take note of where it says:

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation (WCF).

梦与时光遇 2024-07-15 21:56:29

据我所知,您几乎可以返回任何 .NET 类,包括匿名类型。 我已返回代表我的业务实体的自定义对象,包括子实体的通用集合。 Guid、整数、字符串等。基本上任何可以序列化为字符串的东西。

As far as I know, you can pretty much return any .NET class, including anonymous types. I've returned custom objects representing my business entities, including generic collections of children entities. Guids, ints, strings, etc. Anything that can be serialized into a string basically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文