[Solved] Order of the properties settings

Hello everybody,
I write a program to treat pictures that can be stored in a variable number of folders.
The paths to the folders are stored in the properties settings, in user scope.
So, when loading the form I launch this :


		List<string> LFldrs = new List<string>();
		SettingsPropertyCollection collection = Properties.Settings.Default.Properties;
		foreach(SettingsProperty sp in collection)
		{
			if(sp.Name.StartsWith("Path"))
			{
				LFldrs.Add(sp.DefaultValue.ToString());
			}
		}

Well, OK I have my folders in a List, but they are ordered Path2, Path1, Path4, Path3 (and the order of creation is Path1, Path2, Path3, Path4).
OK I could put sp.Name in an OrderedList, and then access the settings by name, but I feel I missed something, no ?

Typically properties are stored in a Map. Why using a List?

better ask usual questions at stackoverflow.com
there are thousands people who knows C#.
CG is not for files, windows forms, properties map

1 Like
var result = Properties.Settings.Default
.Properties.OfType<SettingsProperty>().OrderBy(s => s.Name);

https://social.msdn.microsoft.com/Forums/vstudio/en-US/c8f9680d-0bdf-4105-8ee8-d3189fe4cfd6/order-of-the-settings?forum=csharpgeneral