How to read and write a key_value from a file

  • Thread starter Thread starter IAMI
  • Start date Start date
I

IAMI

Hello, I want to ask a question for a friend of mine.
(I haven't learned C# yet.)

How to read and write a key_value from a file.

I know in Java programming,could do like the following:
===============================
ResourceBundle xBundle = ResourceBundle.getBundle("xxxx");
String testStr = xBundle .getString("testStr")
===============================
In this way I can read the string value "testStr" from the
xxxx.properties.

So now the question is :
In the C# programming, is there any way to read and write
a string value(key_value) from a file. And the file is
"*.conf"¡£

Thanks.
 
The equivalent in c# is ResourceManager.

When you create a .NET form (C# code) you will find a statement called

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));

After getting resources you can get key and value by calling GetObject
Method.

For example to get the list of images you can say

resources.GetObject(""imageList1.ImageStream");

One more example may be

this.axListView1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axListView1.OcxSta
te")));
 
Back
Top