473,472 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a class like java.util.Properties?

Is there a generic Properties class in C# like java.util.properties?
I'd like some class that I can easily write and read from a a file and
that constains <unique_string,stringpairs to be used as a
configuration or parameters or properties file.
I'm working on Compact Framework so I can't use serialization (sob ...)

Feb 14 '07 #1
4 7995
Beorne <ma*******@gmail.comwrote:
Is there a generic Properties class in C# like java.util.properties?
I'd like some class that I can easily write and read from a a file and
that constains <unique_string,stringpairs to be used as a
configuration or parameters or properties file.
I'm working on Compact Framework so I can't use serialization (sob ...)
There isn't a built-in class as far as I'm aware, but it would be very
easy to write one - especially if you don't have many requirements
about escaping etc. I'd suggest making the file UTF-8 rather than
ISO-8859-1 as per Java, however - that way you only need to be able to
escape carriage return, line feed, space etc, rather than \uxxxx as
well.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 14 '07 #2
Jon Skeet [C# MVP] wrote:
I'd suggest making the file UTF-8 rather than
ISO-8859-1 as per Java, however - that way you only need to be able to
escape carriage return, line feed, space etc, rather than \uxxxx as
well.
1.5 can read XML in UTF-8 and 1.6 can read the key=val format
in UTF-8.

Arne

Feb 18 '07 #3
Beorne wrote:
Is there a generic Properties class in C# like java.util.properties?
I'd like some class that I can easily write and read from a a file and
that constains <unique_string,stringpairs to be used as a
configuration or parameters or properties file.
I'm working on Compact Framework so I can't use serialization (sob ...)
Or app config which is probably the true equivalent for
Java properties files.

I think the most .NET'ish way would be to create some code
that reads a XML file in traditional app config format.

Arne
Feb 18 '07 #4
Arne Vajhøj <ar**@vajhoej.dkwrote:
Jon Skeet [C# MVP] wrote:
I'd suggest making the file UTF-8 rather than
ISO-8859-1 as per Java, however - that way you only need to be able to
escape carriage return, line feed, space etc, rather than \uxxxx as
well.
1.5 can read XML in UTF-8
Yes - bit harder to write by hand though.
and 1.6 can read the key=val format in UTF-8.
Now that I didn't know. Hurrah!

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 18 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
0
by: snkssa | last post by:
Hi, I got the following error while building an application with ant. please can you give the solution or reason why it is failing? Thank you create_zip_linux: ...
3
by: jhhbr549 | last post by:
Can some help me with this. Please review this code for errors. I can not get it to complie. Here is my Code .. This is an abstract class that is used in conjuntion with 4 other classes.. ...
1
by: skchonghk | last post by:
Dear all smart experts, I write a simple Java UDF, which should run on DB2 v8 on AIX. But it can't load the Java class. Help ugently needed!! Thanks! I develop and deploy the Java UDF with...
1
by: bjwillykajilly | last post by:
Well, I got an assignment due this morning, so i guess ill end up turning it in a day late eh. anyways. I have a couple problems that I don't know what to do with. the objective is here: Write a...
2
by: twinls1247 | last post by:
I am baffled as to why i keep receiving a "java.lan.NoClassDefFoundError: C:\Ini Exception in thread "main". My CLASSPATH is...
1
by: sandhyabhavani | last post by:
This article is used to zip a file or directory using vb.net. The classes and method to zip a file is availale in java.io, java.util, java.util.zip class library.To import these you have to add a...
0
by: nagashree | last post by:
Hi, i want to compress the file or directory i am able to do that can anybody help me to decompress the file when i double click on the zipped file i am getting the error message as...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.