Static in C# is the same as Shared in VB.  As an example of usinf
Shared, my main project has a class that holds the application
configuration information where every method is Shared.

Why?  Because every object in the application needs the methods of
this configuration class to *always* return the EXACT same information
no matter where they are called from.  If one object changes any of
the data in this class, then every object in the application needs to
see this change immediately.

What information do we store in this configuration class?  Basic data
such as the drive and directory where data files are stored, default
values for some data, user preferences for how the screens are
displayed (color, font, etc...), which modules are licensed to run on
which workstations, and so forth.  Data that remains fixed application
wide and does not vary between object instances.

Hope the example helps.

-- R.B. Davidson

On Apr 17, 8:02 am, VB <[email protected]> wrote:
> Thanks for all reply
> David
> I am not new in OOPs but bit confuse in static classes.... :)
>
> On Apr 16, 6:39 pm, Cerebrus <[email protected]> wrote:
>
>
>
> > The docs provide enough information for this to be VERY clear.
>
> >http://msdn.microsoft.com/en-us/library/79b3xss3(VS.80).aspx
>
> > On Apr 16, 3:21 pm, VB <[email protected]> wrote:
>
> > > why I need to make a class static in c# and when ??
>
> > > Thanks :)- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to