The approach you take to reading from a file that is contained in your XAP is different from one you might take reading a file that is on a server or one that you have copied over to your ClientBin (which could be done using WebClient).
To do this first add the file to your Silverlight project and set the Build Action for this file to be of type Resource.
Next, create a URI that points to the file like I do below and create a StreamResourceInfo from the URI.
Uri uri = new Uri("SilverlightApplication6;component/MyFile.txt", UriKind.Relative)
StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
Replace SilverlightApplication6 above with the namespace used in your Silverlight application. Replace MyFile.txt with the name of your file you added to your Silverlight project.
Next, get the Stream object from StreamResourceInfo and you can then create a StreamReader from the Stream.
if (null != streamInfo)
{
Stream stream = streamInfo.Stream;
StreamReader sr = new StreamReader(stream);
Read more: Everything Silverlight
To do this first add the file to your Silverlight project and set the Build Action for this file to be of type Resource.
Next, create a URI that points to the file like I do below and create a StreamResourceInfo from the URI.
Uri uri = new Uri("SilverlightApplication6;component/MyFile.txt", UriKind.Relative)
StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
Replace SilverlightApplication6 above with the namespace used in your Silverlight application. Replace MyFile.txt with the name of your file you added to your Silverlight project.
Next, get the Stream object from StreamResourceInfo and you can then create a StreamReader from the Stream.
if (null != streamInfo)
{
Stream stream = streamInfo.Stream;
StreamReader sr = new StreamReader(stream);
Read more: Everything Silverlight