WPF: How do I set the content of a Paragraph in Code?

To change the text of an existing paragraph can be done this way. (Individual formattings of the paragraph get lost!)

// myParagraph is the paragraph with the old text

while (myParagraph.Inlines.Count > 0)
    myParagraph.Inlines.Remove(myParagraph.Inlines.ElementAt(0));

myParagraph.Inlines.Add(new Run("new text"));

var paragraph = new Paragraph();
paragraph.Inlines.Add(new Run(yourString));
flowDocument.Blocks.Add(paragraph);