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



Download 21,46 Mb.
Pdf ko'rish
bet206/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   202   203   204   205   206   207   208   209   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

String Concatenation

String variables can be connected together to build larger string types via the C# + operator. As you

may know, this technique is formally termed 

string concatenation. Consider the following new

helper function:

static void StringConcatenation()

{

Console.WriteLine("=> String concatenation:");



string s1 = "Programming the ";

string s2 = "PsychoDrill (PTP)";

string s3 = s1 + s2;

Console.WriteLine(s3);

Console.WriteLine();

}

You may be interested to know that the C# + symbol is processed by the compiler to emit a call



to the static String.Concat() method. In fact, if you were to compile the previous code and open

the assembly within ildasm.exe (see Chapter 1), you would find the CIL code shown in Figure 3-10.



Figure 3-10.

The C# operator results in a call to String.Concat().

C H A P T E R   3  



C O R E   C #   P R O G R A M M I N G   C O N S T R U C T S, PA RT   I



88

8849CH03.qxd  9/24/07  11:07 AM  Page 88




Given this, it is possible to perform string concatenation by calling String.Concat() directly

(although you really have not gained anything by doing so—in fact, you have incurred additional

keystrokes!):

static void StringConcatenation()

{

Console.WriteLine("=> String concatenation:");



string s1 = "Programming the ";

string s2 = "PsychoDrill (PTP)";




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   202   203   204   205   206   207   208   209   ...   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