Can someone explain to me the rationale behind having a static constructor ?
Thanks in advance
A
>From: Jeroen Frijters <[EMAIL PROTECTED]>
>Reply-To: The DOTNET list will be retired 7/1/02 <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: [DOTNET] calling static constructors
>Date: Wed, 5 Jun 2002 15:44:57 +0200
>
>Try the following:
>
>using System;
>
>class T
>{
> static T() { Console.WriteLine("static constructor"); }
>}
>
>class Test
>{
> static void Main()
> {
> Type t = typeof(T);
>
>System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(t.Typ
>eHandle);
> }
>}
>
>Regards,
>Jeroen
>
>
> > -----Original Message-----
> > From: The DOTNET list will be retired 7/1/02
> > [mailto:[EMAIL PROTECTED]] On Behalf Of Dejan Jelovic
> > Sent: Wednesday, June 05, 2002 14:37
> > To: [EMAIL PROTECTED]
> > Subject: [DOTNET] calling static constructors
> >
> >
> > Is there a way to ensure that a static constructor is called
> > for a class
> > without creating an instance or calling some other static function?
> >
> > Thanks,
> > Dejan (www.jelovic.com)
> >
> > You can read messages from the DOTNET archive, unsubscribe
> > from DOTNET, or
> > subscribe to other DevelopMentor lists at http://discuss.develop.com.
> >
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.
Send and receive Hotmail on your mobile device: Click Here
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.