- Home /
 
 
               Question by 
               raqbiel · Dec 02, 2017 at 05:03 PM · 
                c#listarraylistfilestream  
              
 
              Add value to List without replacing previous
Hello! I want to make a history of strings. Everytime when i clicked button elements should save to my list and show in history Text. Here is my button method
public void CustomWord() {
   List<string> list = new List<string>();
   textNew.GetComponent<Text>().text = words[Random.Range(0, words.Length)];
   list.Add(textNew.text);
    FileStream fs = new FileStream("save.dat", FileMode.OpenOrCreate);
    BinaryFormatter bf = new BinaryFormatter();
    bf.Serialize(fs, list);
    fs.Close();
     }
 
               } This method working but every time when I add new values they replacing my old ones and create list of news values. I want to keep my old elements and add new to next line everytime when i click the button.. Anyone know how can i do that?
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
A node in a childnode? 1 Answer
Save string and list to binary file 1 Answer
Arraylist vs List,Arraylist vs list 2 Answers
Trouble Getting Array List To Display Current Song In Game 0 Answers
Combine Children Dictionary in place of Hashtable? 2 Answers