Reading ini file in C#

Posted by pm_2 on Stack Overflow See other posts from Stack Overflow or by pm_2
Published on 2010-05-12T09:41:43Z Indexed on 2010/05/12 9:44 UTC
Read the original article Hit count: 225

Filed under:
|
|

I am trying to read an ini file that has the following format:

SETTING=VALUE

SETTING2=VALUE2

I currently have the following code:

string cache = sr.ReadToEnd();                    
string[] splitCache = cache.Split(new string[] {"\n", "\r\n"}, StringSplitOptions.RemoveEmptyEntries);

Which gives me a list of settings, however, what I would like to do is read this into a dictionary. My question is, is there a way to do this without iterating through the entire array and manually populating the dictionary?

© Stack Overflow or respective owner

Related posts about c#

Related posts about arrays