9
Answers

Re-adding a List

A Repasky

A Repasky

13y
1.2k
1
I am saving a Code and Description in a List<T>.

As I get all the Codes and Description from the database I am storing them in the List.  But a few of the Descriptions have a second entry with the same Code to continue the Desciption that does not fit in the first entry field.  So I add it to the Description and want to overwrite the List item.  Just doing an Add does not do it.  So I thought that if I find the index with IndexOf and do a RemoveAt and then do an Add again it would do it and it does not abort, but does not store anything.

Here is the code.
            reasonList.IndexOf(myReason, indx);
            reasonList.RemoveAt(indx);
            reasonList.Add(new ReasonRecord(dataRowItem["Code"].ToString(), myReasonDesc));






myReasonDesc is the Description that adds the second Description to the first Description.




Say the first Description is "CLAIM WAS PAID UNDER THE NATIONAL PREFERRED" and
the second is " PROVIDER NETWORK". I now want to store the

"CLAIM WAS PAID UNDER THE NATIONAL PREFERRED  PROVIDER NETWORK"





How can I do this?
Thanks for any help.



arep

Answers (9)