How to read a user setting in another project?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne

    How to read a user setting in another project?

    There are two projects in my solution, one is utility dll and the
    other is the main executable. I have user settings in the exe project.
    However I want to read the settings in the utility dll so that the
    utility dll can be reused in other projects but generate project-
    specified results. The scenario would be

    namespace dll
    {
    static class StringGenerator
    {
    static public string ProjectSpecifie dString()
    {
    return String.Format(" {0} is project specified.",
    Assembly.GetExe cutingAssembly( )... /*The answer to my question!*/);
    }
    }
    }
  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: How to read a user setting in another project?

    On Jul 17, 6:38 pm, Wayne <wayne...@gmail .comwrote:
    There are two projects in my solution, one is utility dll and the
    other is the main executable. I have user settings in the exe project.
    However I want to read the settings in the utility dll so that the
    utility dll can be reused in other projects but generate project-
    specified results. The scenario would be
    >
    namespace dll
    {
      static class StringGenerator
      {
         static public string ProjectSpecifie dString()
         {
           return String.Format(" {0} is project specified.",
    Assembly.GetExe cutingAssembly( )... /*The answer to my question!*/);
         }
      }
    >
    >
    >
    }- Hide quoted text -
    >
    - Show quoted text -
    You can access the configuration and the settings from any project. it
    can be only defined in the "main" project.
    A little explanation.
    The ConfigurationMa nager is a static class so it's available to ANY
    class in the AppDomain and it will be the same isntance. As your dll
    runs in the same AppDomain than the code that included and loaded the
    configuration you can use it.

    Comment

    Working...