Groups | Blog | Home
all groups > asp.net webservices > march 2005 >

asp.net webservices : Defining a property



Brock Allen
3/29/2005 1:09:34 PM
WebServices doesn't support properties. This would be a bad precedent as
it skews people's thinking that web services are about objects (and properties)
when they're not.

-Brock
DevelopMentor
http://staff.develop.com/ballen



[quoted text, click to view]


Maziar Aflatoun
3/29/2005 3:29:53 PM
Hi everyone,

A web service method is declared by
[WebMethod]
public void MyMethod() {
}

However, this doesn't work with get/set property? How would one go about
defining a get/set property in a web service?
ex.

[WebMethod]
public string custFirstName
{
get
{
return FirstName;
}
}

Error: Attribute 'WebMethod' is not valid on this declaration type. It is
valid on 'method' declarations only.


Thank you
Maz.

AddThis Social Bookmark Button