简体   繁体   中英

How can I get path of user.config from another assambly?

I would like to have only one configuration file for all assemblies that are in my solution. So what is the best way to get the path of user.config from an other assembly?

user.config is nothing but a xml file. You can read it with XmlDocument then.

XmlDocument doc = new XmlDocument();
doc.LoadXml("user.config");

XmlElement element = doc.DocumentElement;

XmlAttributeCollection attr_coll = myElement.Attributes;

for (int i = 0; i < attr_coll.Count; i++)
{
    string attr_name = attr_coll[i].Name;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM