Get filename from XML instead of content

I’m looking for a way to compare the filename of an .xml-file to a bunch of strings in a dictionary. However, I can’t seem to get the filename of the .xml, only it’s content. I’m handling my .xml-files as XDocument. To illustrate my problem, please help me solve the following issue:

foreach (XDocument xml in MyDictionary){
    Debug.Log ("Filename of xml is: " + ???);

What should I put instead of the question marks in order to log the filename of the .xml-file? Is some type of conversion necessary? Thanks in advance for any help or directions! :slight_smile:

An XDocument only represents XML content. It has no relation to a file. How do you create your XDocument instances? Also How does your dictionary looks like? What’s the key and what’s the value?

If the dictionary is a Dictionary<string, XDocument> and the key is a filename you may want to use

foreach(string key in MyDictionary.Keys)