Instance Scoped Settings

S

Sid Price

I am writing an application that needs to be a multi-instance application.
With VB.NET 2005 this is pretty straight-forward except that I can not find
any information about saving instance specific settings. The idea would be
to have an instance identifier passed into the application from the command
line that would identify the particular instance and then to use that to
recover the settings specific to that instance. I realize this can be done
using an XML or other format file but it seems that it should be possible to
make use of a settings type class. At this time I have not found a way of
doing this and would appreciate any suggestions,
Sid.
 
P

Peter Duniho

[...] The idea would be
to have an instance identifier passed into the application from the command
line that would identify the particular instance and then to use that to
recover the settings specific to that instance. I realize this can be done
using an XML or other format file but it seems that it should be possible to
make use of a settings type class. At this time I have not found a way of
doing this and would appreciate any suggestions,

Off the top of my head, I can't recall if the basic Settings class used
in VS 2005/.NET 2.0 supports targeting a specific file. But if not,
I'm almost positive that the ConfigurationManager does.

So, you could save and load settings that way. That should minimize or
eliminate any need to write custom XML generation/parsing code.

Of course, there's also always just regular serialization. You could
create a class to save the settings, mark it as [Serializable] and then
save/load an instance of that class to/from a specific FileStream.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top