DEV Community

asilbek ibragimov
asilbek ibragimov

Posted on

1 1 1 1 1

Formatlash

C# dasturlash tilida formatish turli usullarda amalga 
oshiriladi, Eng kop ishlatiladigan usullardan biri String 
Format va Interpolation ($ belgisi yor ishlatiladi.
Enter fullscreen mode Exit fullscreen mode

String-Format ga misol:

int yosh = 24;
double kasSon = 12.2;
string ism = "ilmhub";
string natija = String-Format ("Mening yoshim {0}, \nMen
kiritgan kasrSon: {1),\nMening ismim (2}", yosh, kasrSon, ism);

Console. WriteLine(natija);

Bu yerda {0) va (1) o'rin bosuchi (placehold) sifatida ishlatiladi, ularni is va yosh o'zgaruvchilari qiy,ati bilan to' ldiradi.

 Interpolation - $ belgisi yordamida formatlab chop etish, 
 qo'shtirnoq ichida inject(ukol) qilish, o' zgaruvchilardan 
 foydalanish.
Enter fullscreen mode Exit fullscreen mode

Console.Write("Enter the number: ");
var number = Convert. ToInt32 (Console.ReadLine());
Console.Write("Enter your name: ");
string? ism = Console.ReadLine();
Console.WriteLine($"Mening ismim: (ism). \nMen kiritgan ragam: (number}");

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more