Whatever you do, it will have to be 1 line of code.

Whether you specify an attribute, or somehow hook up an event or simply call
the RegisterPrefix method, its all the same amount of effort.

Assemblies are delay loaded, so something external to an assembly needs to
reference something inside the assembly for it to be loaded.



Richard

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
> Reggie Burnett
> Sent: 24 May 2002 15:58
> To: [EMAIL PROTECTED]
> Subject: Re: [DOTNET] Automatically executing code
>
>
> That's what I thought. I tried using a static constructor but you have
> to explicitly create an object to get it to fire.  I'm looking for
> something that will automatically run the code to register  my prefix
> without the user of the lib having to do anything.  Their first line of
> code should be something like
>
> Wr = WebRequest.Create("blah blah url");
>
> Is there something at the assembly level or an attribute that I could
> use to automatically fire some code at app startup?
>
> Reggie
>
> > -----Original Message-----
> > From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf
> Of
> > Richard Birkby
> > Sent: Friday, May 24, 2002 4:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [DOTNET] Automatically executing code
> >
> > Can you use a static constructor somewhere?
> > System.Net registers HTTP, HTTPS and FILE the first time the prefix
> list
> > is
> > used *.
> >
> >
> > Richard
> > * It uses a double check locking idiom without a volatile keyword...
> >
> > > -----Original Message-----
> > > From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf
> Of
> > > Reggie Burnett
> > > Sent: 24 May 2002 01:17
> > > To: [EMAIL PROTECTED]
> > > Subject: [DOTNET] Automatically executing code
> > >
> > >
> > > I'm implementing a webrequest/webresponse pair and the docs say that
> you
> > > have to call WebRequest.RegisterPrefix to register your creator
> object
> > > with that prefix.  What is the best way to make that call
> automatically
> > > without the user of the library needing to explicitly do that?
> > >
> > > Reggie
> > >
> > > 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.
>
> 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.

Reply via email to