<WebMethod()> In Front Of Each public function ?

  • Thread starter Thread starter Herfried K. Wagner [MVP]
  • Start date Start date
H

Herfried K. Wagner [MVP]

* Tiraman said:
i have a class with few functions which some of them are public.

why not to put the <WebMethod()> in front of each public function as a
concept ?

Why do you want to do that?!
 
Webmethod indicates that it is a callable method of a web service. Public
means that is available to other classes in the assembly. 2 different
things.

It could be public to the assembly but not callable via a web service.
 
Hi,

i have a class with few functions which some of them are public.

why not to put the <WebMethod()> in front of each public function as a
concept ?
 
bcz in that way there is no need to change the code when i will be ask to
make the function available for the web.

the question is why not ?
is it a performance issue ?

10x
 
ok but as far as i know it can't be private in the assembly and callable via
a web service.
 
* Tiraman said:
bcz in that way there is no need to change the code when i will be ask to
make the function available for the web.

the question is why not ?
is it a performance issue ?

IMO it simply doesn't make sense. I would mark methods as webmethod "by
need" so the code is easier to understand. When marking every method as
webmethod, this would semantically make no sense for most methods.
 
ok,
i got your point.

10x

Herfried K. Wagner said:
IMO it simply doesn't make sense. I would mark methods as webmethod "by
need" so the code is easier to understand. When marking every method as
webmethod, this would semantically make no sense for most methods.
 
Back
Top