如何在asp.net webservices中使用类数据类型 [英] how to use class datatypes in asp.net webservices
本文介绍了如何在asp.net webservices中使用类数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在asp.net网络服务中使用class作为数据类型。
hi can i use class as datatypes in asp.net web services.
class person
{
string username;
string age;
string address;
}
[webmethod]
public void test(person p)
{
}
推荐答案
参考
http://forums.asp.net/t/1071079.aspx [ ^ ]
是的,你可以这样做..
这里样本:
yes you can do it..
here the sample:
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public person GetPerson()
{
return new person() {username ="some" , address ="add",age = 25 };
}
[WebMethod]
public void passPersonToDosomeAction(person p)
{
string addres = p.address;
// do something
}
}
public class person
{
public string username { get; set; }
public int age { get; set; }
public string address { get; set; }
}
使容器类公开就足够了。该框架将负责其余部分。
Making the container class public should be enough. The framework will take care of the rest.
这篇关于如何在asp.net webservices中使用类数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文