Professional IronPython


Creating a Reference to .NET Assemblies



Download 20,35 Mb.
Pdf ko'rish
bet140/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   136   137   138   139   140   141   142   143   ...   453
Creating a Reference to .NET Assemblies
Not every .NET assembly is available to IronPython by default, even if that assembly appears in the 
Global Assembly Cache (GAC). As with any other .NET language, you sometimes need to reference 
.NET assemblies in order to import and use them. For example, try typing
from System.Xml import *
and press Enter. You get an error message as output stating the following:
from System.Xml import *
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named Xml
FIguRE 7-6: 
Modify the buffer to hold more
lines of information.
FIguRE 7-7: 
Choose a configuration
change option that matches your
.NET usage habits.
548592c07.indd 123
2/25/10 9:44:27 AM
www.finebook.ir


124

CHAPTER 7
Accessing the .net FrAmework
FIguRE 7-8: 
The screen buffer is now large enough to hold the help information you need.
Of course, you know that the 
System.Xml
assembly does exist. This error message tells you that you 
have to add a reference to the 
System.Xml
assembly before you can use it. In order to add a reference, 
you must import the 
clr
(Common Language Runtime) module. You can then use one of the five
following methods to import the assembly.
➤➤
clr.AddReference(
AssemblyObjectOrFilename
)
: Adds a reference to the .NET assem-
bly by passing an assembly object directly or by specifying the assembly filename. (You can 
provide either a partial or full filename.) This is a generic sort of assembly reference addition 
because you don’t have control over which assembly version IronPython loads. You can use 
this method when you’re experimenting and really don’t care about which version of the .NET 
assembly you get. This is also a good method to use when you’re not sure which version of the 
assembly the user has installed on his or her machine but do know that all versions of the .NET 
Framework include the functionality you require. 



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   136   137   138   139   140   141   142   143   ...   453




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