properties file

  • Thread starter Thread starter ffmelo
  • Start date Start date
F

ffmelo

I need something like java.util.Properties class...
I want to store properties in a text file and to get at runtime.

Example in java:

text file
------
propertieName1=propertieValue1
propertieName2=propertieValue2
propertieName3=propertieValue3
------

So, using Properties class I can get the properties by name.
And I can change the properties values without need to compile the
aplication again.

Thanks.
 
Hi,

The configuration applications block might be usefull :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/config.asp

Regards,
Bart

--
http://www.xenopz.com


ffmelo said:
I need something like java.util.Properties class...
I want to store properties in a text file and to get at runtime.

Example in java:

text file
------
propertieName1=propertieValue1
propertieName2=propertieValue2
propertieName3=propertieValue3
------

So, using Properties class I can get the properties by name.
And I can change the properties values without need to compile the
aplication again.

Thanks.
 
Hi,

you can store you properties in your app.config file:

<configuration>
<appSettings>
<add key="PropertyName" value="value"/>
</appSettings>
</configuration>


and get them via:

string s =
System.Configuration.ConfigurationSettings.AppSettings["PropertyName"];

I need something like java.util.Properties class...
I want to store properties in a text file and to get at runtime.

Example in java:

text file
------
propertieName1=propertieValue1
propertieName2=propertieValue2
propertieName3=propertieValue3
------

So, using Properties class I can get the properties by name.
And I can change the properties values without need to compile the
aplication again.

Thanks.
 
ffmelo said:
if I change the app.config need do I compile the application again?

Assuming you just changed values and not key names, no - you just need
to restart the application for those changes to take effect.
 
Ah - good point. I didn't notice the '.' and thought he said app
config, meaning just the config file created from web.config or
app.config.

Sorry!
Clint
 
Back
Top