This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet1102/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1098   1099   1100   1101   1102   1103   1104   1105   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Event

Meaning in Life

AssemblyLoad

Occurs when an assembly is loaded

AssemblyResolve

Occurs when the resolution of an assembly fails

DomainUnload

Occurs when an AppDomain is about to be unloaded

ProcessExit

Occurs on the default application domain when the default application

domain’s parent process exits

ResourceResolve

Occurs when the resolution of a resource fails

TypeResolve

Occurs when the resolution of a type fails

UnhandledException

Occurs when an exception is not caught by an event handler



Enumerating a Process’s AppDomains

To illustrate how to interact with .NET application domains programmatically, assume you have a

new C# Console Application named AppDomainManipulator that defines a static method named

PrintAllAssembliesInAppDomain() within the Program type. This helper method makes use of

AppDomain.GetAssemblies() to obtain a list of all .NET binaries hosted within the application

domain in question.

This list is represented by an array of System.Reflection.Assembly types, and thus you are

required to use the System.Reflection namespace (see Chapter 16). Once you acquire the assembly

array, you iterate over the array and print out the friendly name and version of each assembly:

static void PrintAllAssembliesInAppDomain(AppDomain ad)

{

Assembly[] loadedAssemblies = ad.GetAssemblies();



Console.WriteLine("***** Here are the assemblies loaded in {0} *****\n",

ad.FriendlyName);

foreach(Assembly a in loadedAssemblies)

{

Console.WriteLine("-> Name: {0}", a.GetName().Name);



Console.WriteLine("-> Version: {0}\n", a.GetName().Version);

}

}



Now let’s update the Main() method to obtain a reference to the current application domain

before invoking PrintAllAssembliesInAppDomain(), using the AppDomain.CurrentDomain property.

To make things a bit more interesting, notice that the Main() method launches a Windows

Forms message box to force the CLR to load the System.Windows.Forms.dll, System.Drawing.dll,

and System.dll assemblies (so be sure to set a reference to these assemblies and update your using

statements appropriately):

static void Main(string[] args)

{

Console.WriteLine("***** Fun with AppDomains *****\n");




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1098   1099   1100   1101   1102   1103   1104   1105   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish