Add item to List

Làm thế nào có thể khởi tạo [với trình khởi tạo C #] một danh sách các chuỗi? Tôi đã thử với ví dụ dưới đây nhưng nó không hoạt động.

List optionList = new List { "AdditionalCardPersonAddressType","AutomaticRaiseCreditLimit","CardDeliveryTimeWeekDay" }[];

Listdata = {"a","b","c","d" ......}

this is my list . i need to add "cc" in every element of that list.

like this , data = {"acc","bcc","ccc","dcc" ......} so on ..

how can i make it dynamically ??

What I have tried:

Listdata = {"a","b","c","d" ......}
int count = 50 [ i have 50 elements in list ]
for [int i = 0; i < count ; i++]
{

}

Video liên quan

Chủ Đề