how to use memorystream in printdialog c# code example

Example 1: How to search for a string from readline in c#

string s = "abc";//string to be searched
//'line' is the storing the line which is read
if(line.Contains(s))
{
   //action to be performed
}

Example 2: how to add a list to observablecollection in c#

var stringList = new List<string>() {"1","2","3"};
//Use the contructor override to add the list to the new collection
var obStrings = new ObservableCollection<string>(stringList);

//If you already have a collection. Store that into a tempory list, 
//add the new range to the tempory list. Then same as above
var ob2list = obStrings.ToList();
ob2list.AddRange(stringList);
obStrings = new System.Collections.ObjectModel.ObservableCollection<string>(ob2list);