Defining a property

M

Maziar Aflatoun

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.
 
B

Brock Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top