Shared methods

Results 1 to 2 of 2

Thread: Shared methods

  1. #1
    Join Date
    Dec 1969

    Default Shared methods

    I have a number of functions that stands on it&#039;s own and don&#039;t need any values given to it by a constuctor and son on.<BR><BR>Would the right approach with these kind of methods be to make them shared? Is there any drawbacks with making methods shared?

  2. #2
    Join Date
    Dec 1969

    Default RE: Shared methods

    use sharded / static methods when you don&#039;t want to have to create an instance of an object to be able to call a method in the class<BR><BR>This is typically done because the object is not going to hold any state - it is just going to do a job then finsih. Or return a discreet result. e.g. the sqlhelper classes provided by microsoft that allow you to call stored procs etc.<BR><BR>they are all implemented as shared methods so you can quickly get the result set from your DB without having to first create a sqlhelper object<BR><BR>I don&#039;t know of any drawbacks of doing this (I use them all the time)<BR><BR>sounds like they would be relevant to what you want to do<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts