Can .NET load and parse a properties file equivalent to Java Properties class?

No there is no built-in support for this.

You have to make your own “INIFileReader”.
Maybe something like this?

var data = new Dictionary<string, string>();
foreach (var row in File.ReadAllLines(PATH_TO_FILE))
  data.Add(row.Split('=')[0], string.Join("=",row.Split('=').Skip(1).ToArray()));

Console.WriteLine(data["ServerName"]);

Edit: Updated to reflect Paul’s comment.

Leave a Comment