I have a list of XmlTextReaders from the System.Xml namespace like so
List<XmlTextReader> test = new List<XmlTextReader>{};
that then has elements added to it like so
IEnumerable<string> Files = Directory.GetFiles(ConfigurationManager.AppSettings.Get("TestDirectory"));
if (Files.Count() == 0) //the check for existance and the catch aren't included in this snippet
throw new DirectoryNotFoundException("The directory exists, however it is empty.");
foreach(var file in Files)
{
test.Add(new XmlTextReader(file));
}
Once I have passed this list to another class, is there a way for me to retrieve the file name/path?
I have searched through the MSDN class information and as far as I can tell there is nothing of the sort, but I'm hoping I just missed it.
If it is not possible, I will instead pass the files and not the XmlTextReaders, in order to maintain the paths and just open them into readers later. But I'm hoping there is a property/method of XmlTextReader that I am just misunderstanding that will give me the file name or path (I don't even need the whole path, just the name.)