C# – Automatically run code on referenced assembly during startup?? What is this called

asp.netcnet

In .NET, there is something that can automatically run a piece of code in a referenced assembly when the assembly is loaded.

For example, you can have a class decorated with a sort of attribute that lives in project Foo(A Class Library). And project Bar(A Web App) simply references project Foo. When Bar loads, that decorated code in Foo gets run somehow. I believe this is a newer feature.

Can someone tell what this feature is called??

Update: Thanks Shiva! Not Module Initialize. Although it lead me to the right answer. PreApplicationStartMethod and it's supported in .NET! Thanks all!!

Best Answer

Turns out I was looking for PreApplicationStartMethod! Thanks all!