Easiest way to read a config file belonging to another application

前端 未结 3 1655
予麋鹿
予麋鹿 2021-01-13 08:49

Other than using raw XML, is there an easy way in .NET to open and read a config file belonging to another assembly...? I don\'t need to write to it, just grab a couple of

相关标签:
3条回答
  • 2021-01-13 09:01

    Here's MSDN on OpenExeConfiguration.

    Edit: link to a how-to on eggheadcafe.com disappeared. Looks like EggheadCafe moved to NullSkull but dropped the article ID's.

    0 讨论(0)
  • 2021-01-13 09:12

    Or perhaps you could Serialize a simple class with the [Serializable()] attribute to a file... and deserialize in the other app...

    http://www.dotnetperls.com/serialize-list
    http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx

    The sample program shows one short bit of code to serialize to a file and another to read file...

    You can serialize to a file, to XML, to SOAP...

    0 讨论(0)
  • 2021-01-13 09:23

    Have you tried ConfigurationManager and OpenExeConfiguration(path)? (in System.Configuration.dll)

    0 讨论(0)
提交回复
热议问题