Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

Shared Functions

Is there a rule of thumb when to use and when not  to use "Shared"  in a Class. I can see the benefit from this sample. However, should I use shared all the time so that I don't have to cretae a new object each time?

http://www.sitecrafting.com/blog/aspnet-20-tips-shared-functions/
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Haver Ramirez
Haver Ramirez

in my opinion,use it for utilities methods, you cannot contains shared variables, because you are not in control about his value in some time.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As a rule of thumb and in plain worlds I would say:
- A shared or static member (either field, property or method) doesn't require to use contextual information from an specific class instance.