PC Review


Reply
Thread Tools Rate Thread

Configuration Settings

 
 
Trey
Guest
Posts: n/a
 
      27th Dec 2003
I can't believe that Dot.Net has no easy to use INI file replacement.

In Delphi you set up a class to read/write data from by using this
statement.

theINI := TIniFile.Create(filename);

To read from it you do something like:

frmMain.top := theINI.ReadInteger('INIT','Top',50);
frmMain.left := theINI.ReadInteger('INIT','Left',50);

and to write:

theINI.WriteInteger('INIT','Top',frmMain.Top);
theINI.WriteInteger('INIT','Left',frmMain.Left);

Pretty simple huh?

Am I missing something?


 
Reply With Quote
 
 
 
 
Gabriel
Guest
Posts: n/a
 
      27th Dec 2003
Yes, you are missing something! Try
System.Xml.XmlSerializer, you don't even have to manually
read the data yourself. You can create a config class
with the data you need to store as public variables or
public properties. Then simply call .Serialize and it'll
save all your data to an XML file of your choice. That's
it! Want to deserialize? Call .Deserialize, passing the
XML file, it'll create an instance of your config class
with all the data that was in the XML file. It's that
simple.

>-----Original Message-----
>I can't believe that Dot.Net has no easy to use INI file

replacement.
>
>In Delphi you set up a class to read/write data from by

using this
>statement.
>
> theINI := TIniFile.Create(filename);
>
>To read from it you do something like:
>
> frmMain.top := theINI.ReadInteger('INIT','Top',50);
> frmMain.left := theINI.ReadInteger

('INIT','Left',50);
>
>and to write:
>
> theINI.WriteInteger('INIT','Top',frmMain.Top);
> theINI.WriteInteger('INIT','Left',frmMain.Left);
>
>Pretty simple huh?
>
>Am I missing something?
>
>
>.
>

 
Reply With Quote
 
nickp
Guest
Posts: n/a
 
      27th Dec 2003
Trey,
Just wanted to suggest yet another method of managing your configuration settings. I have written an article that details this as an extension to the Configuration Settings class in .NET. This will store all of your information in an XML file. Check it out at:

<a href="http://www.codeproject.com/csharp/config_settings.asp" target="_blank">An extension for a Configuration Settings class in .NET</a>

Hope this helps,
Nick Parker


---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuration Settings =?Utf-8?B?R2VyNjg=?= Windows XP General 2 26th May 2006 03:52 PM
configuration settings rjl Microsoft ASP .NET 4 16th May 2006 06:21 PM
Configuration and Settings Kent Boogaart Microsoft Dot NET 1 3rd Mar 2006 12:17 PM
Adapter configuration settings =?Utf-8?B?Um9va2ll?= Windows XP WMI 1 25th Aug 2005 11:57 AM
Configuration settings Boris Microsoft C# .NET 3 26th Apr 2004 04:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:39 AM.