When I run the following code, an XML file is correctly created in c:\temp
:
XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection<Models.Customer>));
using (StreamWriter wr = new StreamWriter("C:/temp/CustomerMock2.xml"))
{
xs.Serialize(wr, CustomerList);
}
However, I actually want it to be created in a sub-directory underneath the project, but when I do this:
using (StreamWriter wr = new StreamWriter("Data/CustomerMock2.xml"))
it just acts as if it writes it but the file never appears in that directory:
C:\Projects\Prototype12\CustomersModul\bin\Debug\Data
.
How can I create a file with StreamWriter with a relative path inside my project?