Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet143/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   139   140   141   142   143   144   145   146   ...   453
126

CHAPTER 7
Accessing the .net FrAmework
FIguRE 7-9: 
Verify that you can access the System.Xml assembly.
If you import a module or assembly by mistake, you can unload it in
the same way as you remove variables you no longer need, by typing
del
. For example, if you want to get rid of the 
System.Xml
 assembly after using it, type 
del System
 and press Enter. The 
module or assembly you want to remove must appear in the 
dir()
 list. In this 
case, when you type 
dir()
 after importing 
System.Xml
, you see 
System
, not 
System.Xml
 in the 
dir()
 list, so you must 
del System
, not 
del System.Xml

Never set an assembly or module reference to 
None
 (as you would for clear-
ing a variable) because the reference will remain, but none of the content will 
exist, causing hard to find errors in your application.
uSINg .NET DATA TyPES
When you work with .NET in IronPython, you have full access to every type that .NET supports. 
However, you don’t always create these types as you would in another language. For example, when 
working with C# or Visual Basic, you simply declare a variable of a certain type and then make an 
assignment to it. When working in IronPython, you must remember that making an assignment cre-
ates a Python type, not a .NET type. For example, let’s suppose you create a 
UInt32
variable and 
then make an assignment to it. Figure 7-10 shows the sequence of events that will occur.
As you can see, when you initially create the variable, IronPython recognizes it as a 
UInt32
. In fact, 
even the 
type()
function knows that this is a 
UInt32
. When the code makes a simple assignment, 
however, notice that IronPython changes the type to a simple 
int
. A check using 
type()
shows that 
the data type has indeed changed. In order to change the value of a 
UInt32
, you must make another 
assignment using the 
UInt32()
constructor.
548592c07.indd 126
2/25/10 9:44:28 AM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   139   140   141   142   143   144   145   146   ...   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