c# - How to Add multiple item in list Windows Phone -
i working on windows phone app , want add item in exists list problem when have added first item ok when adding second item list replace previous added item
private void btn_profession_loaded(object sender, routedeventargs e) { try { selectedkeywordsids = app.skillids; // selected keyword selectedprofname = app.professionalname; selectedprofid = app.professionalid; this.btn_profession.content = selectedprofname; key = app.skillkeywords ; pro = app.professionalname; final1=key.replace(pro, ""); list<string> numbers = final1.split(',').tolist<string>(); numbers.add(selectedkeywordsids); numbers = numbers.where(s => !string.isnullorwhitespace(s)).distinct().tolist(); listbox1.itemssource = null; listbox1.itemssource = numbers; }
it looks building list previous variable final1 each time before adding item. should consider this
final1 = string.join(',', numbers.toarray());
after add new item. changes done "numbers" collection stored comma separated items in final1 variable.
Comments
Post a Comment