简体   繁体   中英

How to Determine Which C# Settings File Is Being Used

The Settings.settings file that's part of my C# application has the following User entry. It is called selected_device_idx; is an int ; and its value is set to -1.

Yet, during startup, when I fetch this value, it is set to another value, 5.

I am using this to fetch the value

int temp_selected_device_idx = (int)Properties.Settings.Default["selected_device_idx"];

How can I determine where the origin of this entry?

I am reposting @HansPassant 's comment as the answer. sz Now, I have to find out why the settings are not holding on a non-development workstation, where I am installing this application.

Hans, Thanks for the comment.

Well, if 5 isn't the default value then it comes from a user.config file. It is hard to find back because it is stored in a AppData directory with a strange name. If you can't find it then SysInternals' Process Monitor can show you. Or just write back whatever value you want and Save() it. – Hans Passant yesterday

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM