Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

Public Access To TypeSafe resources

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Davo - 14 Dec 2005 20:26 GMT
I wish to setup a resource that holds CONSTANT values. The resource
file is call LogCat.resx (Logger Categories) and contains Debug, Info,
Error etc...

This resource is located in a resource only assembly and uses the
custom tool SettingsSingleFileGenerator to generate a typesafe class.

The problem is that the class and all its members are internal so I
cannot access it from other assemblies

Cheers Dave
Nicholas Paldino [.NET/C# MVP] - 14 Dec 2005 21:18 GMT
Davo,

   Why not just create a wrapper class for it then that is public?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I wish to setup a resource that holds CONSTANT values. The resource
> file is call LogCat.resx (Logger Categories) and contains Debug, Info,
[quoted text clipped - 7 lines]
>
> Cheers Dave
Davo - 14 Dec 2005 21:38 GMT
>     Why not just create a wrapper class for it then that is public?

Creating a public accessible class is certainly possible but it defeats
the purpose of Auto Class Generation that is allready built in to .NET
2

I might as well not botthered with a resource file and just used
regular constant class declaration.

I guess what I'm after is a custom code generator for this particular
RESX file or options for the current code generator that will allow it
to generate public accessors.

Dave
Nicholas Paldino [.NET/C# MVP] - 14 Dec 2005 22:02 GMT
Davo,

   Well, you could create your own custom tool which will do this for you.
For more details on how to do this, check out:

http://www.drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/

   From this, it is easy to figure out how to access the functionality of
the original generator.  From there, you can have the original generate your
code, then use the classes from CodeDom to parse the code apart.  Once you
have that, you just set the access modifier to public, and have CodeDom
re-generate the text needed.

   Hope this helps.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>>     Why not just create a wrapper class for it then that is public?
>
[quoted text clipped - 10 lines]
>
> Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.