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



Download 21,46 Mb.
Pdf ko'rish
bet214/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   210   211   212   213   214   215   216   217   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

// StringBuilder lives here!

using System.Text;

What is unique about the StringBuilder is that when you call members of this type, you are

directly modifying the object’s internal character data (and is thus more efficient), not obtaining a

copy of the data in a modified format. When you create an instance of the StringBuilder, you can

supply the object’s initial startup values via one of many 



constructors. If you are new to the topic of

constructors, simply understand that constructors allow you to create an object with an initial state

when you apply the new keyword. Consider the following usage of StringBuilder:

static void FunWithStringBuilder()

{

Console.WriteLine("=> Using the StringBuilder:");



StringBuilder sb = new StringBuilder("**** Fantastic Games ****");

sb.Append("\n");

sb.AppendLine("Half Life");

sb.AppendLine("Beyond Good and Evil");

sb.AppendLine("Deus Ex 2");

sb.AppendLine("System Shock");

Console.WriteLine(sb.ToString());

sb.Replace("2", "Invisible War");

Console.WriteLine(sb.ToString());

Console.WriteLine("sb as {0} chars.", sb.Length);

Console.WriteLine();

}

Here we have constructed a StringBuilder set to the initial value "**** Fantastic Games



****". As you can see, we are appending to the internal buffer, and are able to replace (or remove)

characters at will. By default, a StringBuilder is only able to hold a string of 16 characters or less;

however, this initial value can be changed via an additional constructor argument:


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   210   211   212   213   214   215   216   217   ...   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