Written by
in
การต่อ String ใน C# ทำได้ 4 แบบดังนี้
+
string.Concat() สะดวกับการต่อ list หรือ array มาก
string.Format() เหมาะสำหรับต่อ string และจัดการรูปแบบการแสดงผลด้วยไปในคราวเดียวกันเลย
stringBuilder เหมาะสำหรับการต่อ sting ที่มีปริมาณมากๆจะทำงานได้เร็วประมาณ 1000 ขึ้นไป
ถ้ามีเวลาจะมาขยายเรื่องนี้ในหัวข้อการทดสอบ Performance จะมาลองดูว่าแบบไหนเร็วกว่ากันไปซักเท่าไร ตอนนี้เอาเท่านี้ไปก่อนแล้วกันครับ
See author's posts
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Please enter an answer in digits:
Δ
Leave a Reply