Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

shared member performance

We are using general DAL class for all common DB routines. That class has many shared member( functions which can be called without instantiating the class.

My question is, in a multiuser environment, as there is no instantiation involved for this class, how the shared method calls are processed? Being the DAL, the shared member method can be called by different user at the same time. Will there be any performance issue?

I have seen many MSDN code examples uses public shared function for common routines and so wondering whether it is right way for multiuser environment.

Related question is when do you make method of the class shared?

Tuesday, March 2, 2004

Performace issues: no. The only thing to bear in mind with shared (static) stuff is to be careful about storing any state using shared - you need to consider threading issues; ie, concurrent access to that data. If it's just a bunch of fuinctions and there's no shared data, shared methods are just fine.

Duncan Smart
Wednesday, March 3, 2004

*  Recent Topics

*  Fog Creek Home