Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 17 Jul 2008 15:38:02 -0700 (PDT),    group: microsoft.public.dotnet.languages.csharp        back       


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 ProjectSpecifiedString()
     {
       return String.Format("{0} is project specified.",
Assembly.GetExecutingAssembly()... /*The answer to my question!*/);
     }
  }
}
date: Thu, 17 Jul 2008 15:38:02 -0700 (PDT)   author:   Wayne

Re: How to read a user setting in another project?   
On Jul 17, 6:38 pm, Wayne  wrote:
> 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 ProjectSpecifiedString()
>      {
>        return String.Format("{0} is project specified.",
> Assembly.GetExecutingAssembly()... /*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 ConfigurationManager 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.
date: Fri, 18 Jul 2008 07:35:01 -0700 (PDT)   author:   Ignacio Machin ( .NET/ C# MVP )

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us