Сţµç×ÓÊé > ÆäËûµç×ÓÊé > VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) >

µÚ27ÕÂ

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ27ÕÂ

С˵£º VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) ×ÖÊý£º ÿҳ3500×Ö

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡




¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡3¡­9¡¡shows¡¡the¡¡working¡¡solution¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Chaining¡¡ToLower£¨£©¡¡and¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Trim£¨£©¡¡together¡¡first¡¡obtains¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ToLower£¨£©¡¡returns¡¡a¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡result¡¡of¡¡ToLower£¨£©¡¡and¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lowercase¡¡copy¡¡of¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡then¡¡applies¡¡Trim£¨£©¡¡to¡¡it¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡original¡¡string¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Class¡¡Translator¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Shared¡¡Function¡¡TranslateHello£¨ByVal¡¡input¡¡_¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡As¡¡String£©¡¡As¡¡String¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡temp¡¡As¡¡String¡¡=¡¡input¡£ToLower£¨£©¡£Trim£¨£©¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡If¡¡temp¡£pareTo£¨¡¨hello¡¨£©¡¡=¡¡0¡¡Then¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡¡¨hallo¡¨¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ElseIf¡¡temp¡£pareTo£¨¡¨allo¡¨£©¡¡=¡¡0¡¡Then¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡¡¨hallo¡¨¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡If¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Trim£¨£©¡¡removes¡¡whitespace¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Return¡¡¡¨¡¨¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Function¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡3¡­9¡£¡¡¡¡The¡¡final¡¡translation¡¡solution¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡87¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡3¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡AR¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡O¡¡U¡¡T¡¡¡¡¡¡ST¡¡R¡¡I¡¡N¡¡G¡¡¡¡¡¡M¡¡A¡¡N¡¡I¡¡PU¡¡L¡¡A¡¡TI¡¡O¡¡N¡¡S¡¡¡¡65¡¡



¡¡¡¡¡¡¡¡¡¡¡¡Looking¡¡at¡¡the¡¡solution£»¡¡you¡¡see¡¡that¡¡there¡¡are¡¡elements¡¡from¡¡the¡¡first¡¡solution£»¡¡which¡¡was¡¡¡¡

discounted¡¡because¡¡it¡¡did¡¡not¡¡work¡¡properly¡£¡¡This¡¡is¡¡an¡¡example¡¡of¡¡how¡¡quickly¡¡solving¡¡a¡¡bug£»¡¡¡¡

seeing¡¡that¡¡code¡¡fail£»¡¡and¡¡discounting¡¡the¡¡solution¡¡can¡¡be¡¡incorrect¡£¡¡You¡¡need¡¡to¡¡think¡¡through¡¡¡¡

why¡¡something¡¡fails£»¡¡and¡¡not¡¡just¡¡fix¡¡the¡¡bug¡¡to¡¡get¡¡rid¡¡of¡¡it¡£¡¡



¡öNote¡¡¡¡All¡¡of¡¡the¡¡solutions¡¡involved¡¡use¡¡String¡¡type¡¡methods¡£¡¡The¡¡¡¡String¡¡type¡¡is¡¡very¡¡sophisticated¡¡and¡¡¡¡

supports¡¡many¡¡operations¡¡that¡¡are¡¡monly¡¡performed¡¡on¡¡text¡£¡¡



¡¡¡¡¡¡¡¡¡¡At¡¡this¡¡point£»¡¡we¡¡are¡¡finished¡¡with¡¡the¡¡translation¡¡of¡¡the¡¡greeting¡£¡¡Next£»¡¡I¡¯ll¡¡point¡¡out¡¡a¡¡couple¡¡of¡¡¡¡

additional¡¡items¡¡that¡¡you¡¡need¡¡to¡¡keep¡¡in¡¡mind¡¡when¡¡dealing¡¡with¡¡strings¡£¡¡



Quoting¡¡Strings¡¡



Along¡¡with¡¡strings£»¡¡Visual¡¡Basic¡¡has¡¡the¡¡Char¡¡type¡£¡¡A¡¡Char¡¡can¡¡be¡¡described¡¡as¡¡a¡¡single¡¡letter¡¡of¡¡a¡¡¡¡

sentence¡£¡¡However£»¡¡it¡¡would¡¡be¡¡more¡¡accurate¡¡to¡¡say¡¡that¡¡it¡¡is¡¡a¡¡single¡¡character¡£¡¡You¡¡can¡¡assign¡¡¡¡

a¡¡string¡¡to¡¡a¡¡Char¡¡type£»¡¡as¡¡long¡¡as¡¡Option¡¡Strict¡¡is¡¡Off¡¡£¨which¡¡it¡¡is¡¡by¡¡default£©¡£¡¡For¡¡example£»¡¡suppose¡¡¡¡

you¡¡wrote¡¡the¡¡following¡¡code¡¡to¡¡assign¡¡a¡¡string¡¡to¡¡the¡¡variable¡¡val¡£¡¡



¡¡'¡¡The¡¡Option¡¡Strict¡¡declaration¡¡must¡¡e¡¡right¡¡at¡¡the¡¡top¡¡of¡¡your¡¡code¡¡

Option¡¡Strict¡¡Off¡¡

¡¡¡£¡¡¡£¡¡¡£¡¡

Dim¡¡val¡¡As¡¡Char¡¡

val¡¡=¡¡¡¨hello¡¨¡¡



¡¡¡¡¡¡¡¡¡¡The¡¡example¡¡piles£»¡¡but¡¡you¡¡will¡¡not¡¡get¡¡what¡¡you¡¡want¡£¡¡Because¡¡Option¡¡Strict¡¡is¡¡Off£»¡¡¡¡

the¡¡string¡¡is¡¡converted¡¡to¡¡a¡¡character¡£¡¡In¡¡this¡¡conversion£»¡¡data¡¡is¡¡lost¡ªspecifically£»¡¡the¡¡characters¡¡¡¡

ello¡¡are¡¡lost¡£¡¡The¡¡value¡¡stored¡¡in¡¡the¡¡variable¡¡val¡¡is¡¡the¡¡single¡¡letter¡¡h¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡If¡¡Option¡¡Strict¡¡were¡¡On£»¡¡the¡¡example¡¡would¡¡not¡¡pile¡£¡¡When¡¡Option¡¡Strict¡¡is¡¡On£»¡¡the¡¡¡¡

piler¡¡does¡¡not¡¡do¡¡conversions¡¡where¡¡data¡¡might¡¡be¡¡lost¡£¡¡If¡¡you¡¡have¡¡code¡¡that¡¡does¡¡attempt¡¡¡¡

a¡¡conversion£»¡¡an¡¡error¡¡will¡¡be¡¡flagged¡¡by¡¡the¡¡piler¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡If¡¡you¡¡really¡¡wanted¡¡to¡¡store¡¡the¡¡single¡¡letter¡¡h¡¡in¡¡the¡¡variable¡¡val£»¡¡you¡¡would¡¡need¡¡to¡¡explicitly¡¡¡¡

define¡¡the¡¡character¡¡to¡¡be¡¡assigned¡¡to¡¡the¡¡variable£»¡¡as¡¡follows£º¡¡



Option¡¡Strict¡¡On¡¡

¡¡¡£¡¡¡£¡¡¡£¡¡

Dim¡¡val¡¡As¡¡Char¡¡

val¡¡=¡¡¡¨h¡¨c¡¡



¡¡¡¡¡¡¡¡¡¡To¡¡define¡¡a¡¡single¡­character¡¡string£»¡¡you¡¡enclose¡¡that¡¡character¡¡in¡¡double¡¡quotation¡¡marks£»¡¡¡¡

followed¡¡by¡¡a¡¡lowercase¡¡c¡¡to¡¡indicate¡¡that¡¡the¡¡single¡­character¡¡string¡¡is¡¡a¡¡character¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡88¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

66¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡3¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡OU¡¡T¡¡¡¡¡¡ST¡¡R¡¡I¡¡N¡¡G¡¡¡¡¡¡M¡¡A¡¡N¡¡I¡¡P¡¡U¡¡L¡¡AT¡¡IO¡¡N¡¡S¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡VISUAL¡¡BASIC¡¡STRICT¡¡AND¡¡EXPLICIT¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Programming¡¡languages¡¡have¡¡two¡¡distinct¡¡flavors£º¡¡static¡¡typed¡¡and¡¡dynamic¡¡typed¡£¡¡Do¡¡not¡¡get¡¡these¡¡two¡¡terms¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡confused¡¡with¡¡the¡¡terms¡¡strongly¡¡typed¡¡and¡¡¡¡weakly¡¡typed¡£¡¡Those¡¡two¡¡sets¡¡of¡¡terms¡¡are¡¡orthogonal¡¡to¡¡each¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡other¡£¡¡A¡¡language¡¡can¡¡be¡¡dynamic¡¡typed¡¡and¡¡strongly¡¡typed¡¡at¡¡the¡¡same¡¡time¡£¡¡For¡¡example£»¡¡the¡¡following¡¡code¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡is¡¡strongly¡¡and¡¡dynamic¡¡typed¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡a¡¡=¡¡10¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡type¡¡is¡¡dynamic¡¡because¡¡I¡¡have¡¡not¡¡declared¡¡the¡¡variable¡¡to¡¡be¡¡of¡¡any¡¡type¡£¡¡It¡¡is¡¡strongly¡¡typed¡¡because¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡when¡¡a¡¡is¡¡assigned¡¡to¡¡a¡¡value¡¡of¡¡10£»¡¡it¡¡is¡¡defined¡¡to¡¡be¡¡an¡¡Integer¡£¡¡A¡¡strongly¡¡and¡¡dynamic¡¡typed¡¡language¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡means¡¡that¡¡variables¡¡can¡¡be¡¡any¡¡type£»¡¡but¡¡once¡¡they¡¡are¡¡assigned£»¡¡their¡¡type¡¡cannot¡¡be¡¡changed¡£¡¡Thus£»¡¡you¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cannot¡¡convert¡¡an¡¡integer¡¡to¡¡a¡¡string¡¡or¡¡a¡¡string¡¡to¡¡an¡¡integer¡¡without¡¡some¡¡type¡¡of¡¡failure¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡following¡¡code¡¡is¡¡weakly¡¡and¡¡static¡¡typed¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡val¡¡As¡¡Char¡¡=¡¡¡¨hello¡¨¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Here£»¡¡I¡¡explicitly¡¡say¡¡that¡¡val¡¡is¡¡a¡¡Char£»¡¡and¡¡I¡¯ve¡¡assigned¡¡to¡¡it¡¡a¡¡string¡£¡¡However£»¡¡because¡¡of¡¡weak¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡typing£»¡¡a¡¡strong¡­armed¡¡conversion¡¡of¡¡the¡¡string¡¡to¡¡a¡¡Char¡¡is¡¡made¡£¡¡Think¡¡of¡¡it¡¡as¡¡fitting¡¡a¡¡square¡¡peg¡¡into¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡round¡¡hole¡£¡¡If¡¡the¡¡square¡¡peg¡¡has¡¡a¡¡diagonal¡¡length¡¡less¡¡than¡¡the¡¡diameter¡¡of¡¡the¡¡hole£»¡¡the¡¡process¡¡works¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡without¡¡much¡¡effort¡£¡¡But¡¡if¡¡the¡¡square¡¡peg¡¯s¡¡length¡¡is¡¡the¡¡same¡¡as¡¡the¡¡diameter¡¡of¡¡the¡¡hole£»¡¡you¡¡will¡¡need¡¡to¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡use¡¡brute¡¡force¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Visual¡¡Basic¡¡allows¡¡you¡¡to¡¡write¡¡all¡¡types¡¡of¡¡code£»¡¡and¡¡the¡¡flags¡¡Option¡¡Strict¡¡and¡¡Option¡¡Explicit¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡relate¡¡to¡¡what¡¡kind¡¡of¡¡code¡¡you¡¡want¡£¡¡When¡¡you¡¡set¡¡Option¡¡Strict¡¡to¡¡On£»¡¡you¡¡are¡¡saying¡¡that¡¡you¡¡don¡¯t¡¡want¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡to¡¡support¡¡weakly¡¡typed¡¡code¡£¡¡The¡¡flag¡¡has¡¡no¡¡effect¡¡on¡¡dynamic¡¡typing¡£¡¡The¡¡Option¡¡Explicit¡¡flag¡¡does¡¡not¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡affect¡¡weakly¡¡typed¡¡code£»¡¡but¡¡it¡¡partially¡¡affects¡¡dynamic¡¡typed¡¡code¡£¡¡Consider¡¡the¡¡following¡¡code¡¡that¡¡piles¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡when¡¡Option¡¡¡¡Explicit¡¡is¡¡set¡¡to¡¡Off¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a¡¡=¡¡10¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡code¡¡is¡¡an¡¡assignment£»¡¡but¡¡you¡¡don¡¯t¡¡know¡¡if¡¡the¡¡variable¡¡is¡¡declared¡¡in¡¡the¡¡file£»¡¡in¡¡the¡¡class£»¡¡or¡¡local¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡to¡¡the¡¡method¡£¡¡The¡¡variable¡¡could¡¡be¡¡defined¡¡out¡¡of¡¡the¡¡blue¡¡and¡¡then¡¡used¡£¡¡Dynamic¡¡typing¡¡allows¡¡this£»¡¡but¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡again£»¡¡after¡¡the¡¡variable¡¡has¡¡been¡¡assigned£»¡¡it¡¡stays¡¡the¡¡same¡¡type¡£¡¡When¡¡you¡¡set¡¡Option¡¡¡¡Explicit¡¡to¡¡On£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡you¡¡are¡¡making¡¡an¡¡explicit¡¡declaration¡¡of¡¡the¡¡variable¡¡a¡¡requirement¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡With¡¡all¡¡of¡¡these¡¡options£»¡¡you¡¡are¡¡left¡¡wondering¡¡which¡¡bination¡¡of¡¡flags¡¡you¡¡want¡£¡¡The¡¡answer¡¡is¡¡that¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡it¡¡depends¡¡on¡¡what¡¡style¡¡of¡¡programmer¡¡you¡¡are¡£¡¡If¡¡you¡¡want¡¡a¡¡traditional¡¡language¡¡£¨like¡¡C#£»¡¡Java£»¡¡C£«£«£»¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡so¡¡on£©£»¡¡then¡¡you¡¡should¡¡have¡¡both¡¡flags¡¡set¡¡to¡¡On¡£¡¡If¡¡you¡¡want¡¡a¡¡more¡¡dynamic¡¡programming¡¡language¡¡£¨like¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Python£»¡¡Ruby£»¡¡PHP£»¡¡and¡¡so¡¡on£©£»¡¡then¡¡you¡¡should¡¡have¡¡both¡¡flags¡¡set¡¡to¡¡Off¡£¡¡Unless¡¡you¡¡have¡¡experience¡¡in¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dynamic¡¡programming¡¡environment¡¡and¡¡know¡¡what¡¡side¡¡effects¡¡may¡¡occur£»¡¡you¡¡should¡¡start¡¡off¡¡taking¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡traditional¡¡language¡¡approach¡£¡¡For¡¡that¡¡reason£»¡¡the¡¡code¡¡in¡¡this¡¡book¡¡is¡¡written¡¡with¡¡both¡¡flags¡¡set¡¡to¡¡On¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡You¡¡can¡¡define¡¡the¡¡Option¡¡Strict¡¡and¡¡Option¡¡Explicit¡¡flags¡¡in¡¡the¡¡source¡¡code£»¡¡as¡¡shown¡¡in¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡examples¡¡in¡¡the¡¡previous¡¡¡°Quoting¡¡Strings¡±¡¡section£»¡¡or¡¡you¡¡can¡¡set¡¡them¡¡in¡¡the¡¡pile¡¡settings¡¡of¡¡the¡¡individual¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡project¡¡settings¡¡or¡¡for¡¡the¡¡whole¡¡of¡¡Visual¡¡Basic¡¡Express¡£¡¡To¡¡set¡¡them¡¡for¡¡a¡¡project£»¡¡right¡­click¡¡the¡¡project¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name¡¡and¡¡select¡¡Properties¡¡¡¡pile¡£¡¡The¡¡two¡¡settings¡¡are¡¡in¡¡the¡¡drop¡­down¡¡boxes¡¡at¡¡the¡¡top¡¡of¡¡the¡¡page¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡To¡¡set¡¡the¡¡options¡¡for¡¡all¡¡projects£»¡¡select¡¡Tools¡¡¡¡Options£»¡¡and¡¡then¡¡select¡¡Projects¡¡and¡¡Solutions¡¡¡¡VB¡¡Defaults¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡89¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡3¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡AR¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡O¡¡U¡¡T¡¡¡¡¡¡ST¡¡R¡¡I¡¡N¡¡G¡¡¡¡¡¡M¡¡A¡¡N¡¡I¡¡PU¡¡L¡¡A¡¡TI¡¡O¡¡N¡¡S¡¡¡¡67¡¡



Character¡¡Mapping¡¡



A¡¡single¡¡character¡¡takes¡¡16¡¡bits¡¡of¡¡spac

·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨2£© ²È£¨2£©

Äã¿ÉÄÜϲ»¶µÄ