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



Download 21,46 Mb.
Pdf ko'rish
bet1072/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1068   1069   1070   1071   1072   1073   1074   1075   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition



Source Code

The VehicleDescriptionAttributeReaderLateBinding project is included under the Chapter 16

subdirectory.

Putting Reflection, Late Binding, and Custom

Attributes in Perspective

Even though you have seen numerous examples of these techniques in action, you may still be

wondering when to make use of reflection, dynamic loading, late binding, and custom attributes in

your programs. To be sure, these topics can seem a bit on the academic side of programming (which

may or may not be a bad thing, depending on your point of view). To help map these topics to a

real-world situation, you need a solid example. Assume for the moment that you are on a program-

ming team that is building an application with the following requirement:

• The product must be extendable by the use of additional third-party tools.

So, what exactly is meant by 

extendable? Consider the Visual Studio 2008 IDE. When this appli-

cation was developed, various “hooks” were inserted to allow other software vendors to snap

custom modules into the IDE. Obviously, the Visual Studio 2008 development team had no way to

set references to external .NET assemblies it had not developed yet (thus, no early binding), so how

exactly would an application provide the required hooks? Here is one possible way to solve this

problem:


• First, an extendable application must provide some input vehicle to allow the user to specify

the module to plug in (such as a dialog box or command-line flag). This requires 



dynamic

loading.

• Second, an extendable application must be able to determine whether the module supports

the correct functionality (such as a set of required interfaces) in order to be plugged into the

environment. This requires 



reflection.

• Finally, an extendable application must obtain a reference to the required infrastructure

(such as a set of interface types) and invoke the members to trigger the underlying function-

ality. This may require 



late binding.

Simply put, if the extendable application has been preprogrammed to query for specific inter-

faces, it is able to determine at runtime whether the type can be activated. Once this verification

test has been passed, the type in question may support additional interfaces that provide a poly-

morphic fabric to their functionality. This is the exact approach taken by the Visual Studio 2008

team, and despite what you may be thinking, is not at all difficult.




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1068   1069   1070   1071   1072   1073   1074   1075   ...   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