C# 0 The Complete Reference


orgstr  is unchanged and  substr



Download 4,07 Mb.
Pdf ko'rish
bet230/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   226   227   228   229   230   231   232   233   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

orgstr

 is unchanged and 



substr

 contains the substring.

One more point: Although the immutability of 

string

 objects is not usually a restriction 

or hindrance, there may be times when it would be beneficial to modify a string. To allow 

this, C# offers a class called 



StringBuilder

, which is in the 



System.Text

 namespace. It 

creates string objects that can be changed. For most purposes, however, you will want to use 

string

, not 


StringBuilder

.

Strings Can Be Used in switch Statements

A

string

 can be used to control a 



switch

 statement. It is the only non-integer type that can 

be used in the 

switch

. The fact that strings can be used in 



switch

 statements makes it 

possible to handle some otherwise challenging situations more easily than you might 

expect. For example, the following program displays the digit equivalent of the words 

“one,” “two,” and “three”:

// A string can control a switch statement.

using System;

class StringSwitch {

  static void Main() {

    string[] strs = { "one", "two", "three", "two", "one" };

www.freepdf-books.com



Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   226   227   228   229   230   231   232   233   ...   1096




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