473,761 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a class like java.util.Prope rties?

Is there a generic Properties class in C# like java.util.prope rties?
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 8014
Beorne <ma*******@gmai l.comwrote:
Is there a generic Properties class in C# like java.util.prope rties?
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.co m>
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.prope rties?
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.d kwrote:
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.co m>
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
12368
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 the file myclass.class? Will this work if it's run from a relative path, like: java ../progs/myclass
4
3427
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
1883
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
4067
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.. They are Hourly, IAm, Salaried, Sales. import java.util.*; //Constructors //Constructor public abstract class Employee
1
4545
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 these steps: 1. Write the java class, compile and make a jar (see below for source). 2. Call SQLJ.REPLACE_JAR ('file:/home/pws01ta/pws01ta1/examples.jar','test',0) 3. call sqlj.refresh_classes() 4. Create the function by running "create function...
1
5042
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 generic class, MyStatisticsClass, with a type parameter T where T is a numeric object type (e.g., Integer, Double, or any class that extends java.lang.Number). Add a method named standardDeviation that takes an ArrayList of type T and returns as a...
2
1457
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 C:\javapgm\testApp\WEB-INF\classes\testenv;C:\oracle\ora92\jdbc\lib\classes12.jar; My class file has been created. Now i need to know what exactly is causing this error outside of CLASSPATH being set. import java.util.Properties; import java.util.Vector; import java.io.FileInputStream;
1
13541
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 reference vsjlib Library in .net component. .NET Classes used : Imports System.IO Imports java.io Imports java.util Imports java.util.zip
0
2152
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 compressed(zipped) folder is invalid or corrupted. I am using VB.NET .Please help me out in this regard...Thank you in advance. Here is the code for that. Public Class clsZip
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10111
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.