Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Static/Shared Webmethod

Reply
Thread Tools

Static/Shared Webmethod

 
 
Rory Becker
Guest
Posts: n/a
 
      06-12-2008
I have been testing a beta feature in Coderush (CodeIssues) which has prompted
me with the suggestion that one of my WebMethods in a Webservice, could be
Shared/Static and is not.

I have never though about this before but I guess I had assumed that there
is very little point in declaring such a method static or not as the web
is stateless ( isn't it?)

Is Coderush correct to suggest this or should I be filing a bug?

--
Rory


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      06-12-2008
if a class method does not reference any its instance members, then it can be
declared static (class method rather than instance method).

class methods are marginally faster (one less parameter, the class instance)
and can be called without creating a class instance.

-- bruce (sqlwork.com)


"Rory Becker" wrote:

> I have been testing a beta feature in Coderush (CodeIssues) which has prompted
> me with the suggestion that one of my WebMethods in a Webservice, could be
> Shared/Static and is not.
>
> I have never though about this before but I guess I had assumed that there
> is very little point in declaring such a method static or not as the web
> is stateless ( isn't it?)
>
> Is Coderush correct to suggest this or should I be filing a bug?
>
> --
> Rory
>
>
>

 
Reply With Quote
 
 
 
 
Steven Cheng [MSFT]
Guest
Posts: n/a
 
      06-13-2008
Hi Rory,

I think Bruce's explanation is reasonable. However, for ASP.NET webservice,
webmethod does should be defined as instance method rather than static. I
think the Coderush might just treat webservice class as as a normal
class(doesn't have sense of webservice). Anyway, I think you you can
report this behavior since in webservice context, that message does be a
bit misleading.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Date: Thu, 12 Jun 2008 13:59:30 +0000 (UTC)
>Message-ID: <(E-Mail Removed) >
>From: Rory Becker <(E-Mail Removed)>
>Subject: Static/Shared Webmethod


>
>I have been testing a beta feature in Coderush (CodeIssues) which has

prompted
>me with the suggestion that one of my WebMethods in a Webservice, could be
>Shared/Static and is not.
>
>I have never though about this before but I guess I had assumed that there
>is very little point in declaring such a method static or not as the web
>is stateless ( isn't it?)
>
>Is Coderush correct to suggest this or should I be filing a bug?
>
>--
>Rory


>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in invoking WebMethod at client side Ram P. Dash ASP .Net 0 11-18-2005 12:06 AM
Catch WebMethod name and params in Application_BeginRequest Franck ASP .Net 1 10-04-2005 11:26 AM
Strange Exception with WebMethod Kevin Spencer ASP .Net 2 10-28-2004 01:31 PM
[WebMethod] doesn' work for properties in WebService sunnyz ASP .Net 1 10-15-2004 07:30 PM
Pulling DataSet From WebMethod -- Possible? Temp ASP .Net 1 08-11-2003 05:13 AM



Advertisments