Bill Baird [mailto:[EMAIL PROTECTED]] wrote:

> How can I determine if a given piece of code is running in
> the default AppDomain.  I searched the archives, but came up empty.

Hmmm... I thought of this, but it feels so hacky:

<codeSnippet language="C#">
// Get the entry point Assembly
Assembly entryPointAssembly = Assembly.GetEntryAssembly();

// Get the current AppDomain
AppDomain currentAppDomain = AppDomain.CurrentDomain;

// Default AppDomain is named after entry point assembly[1], so...
if(currentAppDomain.FriendlyName == entryPointAssembly.GetName().Name)
{
        ... you're in the default domain ...
}
</codeSnippet>

HTH,
Drew

[1]
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemAppDomainClassFriendlyName
Topic.htm

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