By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

[WebMethod] doesn' work for properties in WebService

P: n/a
i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

thx

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> Cud any1 tell me plz which attribute to use for
properties
I cud. None.

Web Services expose methods (behavior), not properties (state). However, as
a property can have a set and a get METHOD, you can certainly write
WebMethods that expose fields and properties. Example:

private string foo = "bar";

[WebMethod]
public string GetFoo()
{
return foo;
}

[WebMethod]
public string SetFoo(string value)
{
foo = value;
}

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"sunnyz" <su****@lycos-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com... i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

thx

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.