简体   繁体   中英

Is Settings.Default being read from memory or disc

I have an application where I want to read as little information from the disc as possible. I have a WPF application in .net core 3.1 where I have created a settings file with user settings like this

在此处输入图像描述

When I read the settings like this

在此处输入图像描述

Which way will it be read?

  1. Read from disc into the memory at application startup, so that it will be read from memory every time.
  2. The first call reads it into memory, so the first read is from disc, and after that read from memory
  3. Always read from disc

The value is read from an assembly that is stored on disk and loaded in the CLR on demand once so I guess the second option is the most correct one.

You cannot really control how the runtime loads the assemblies from disk though so this shouldn't be much of an issue.

Or maybe you should consider simply creating a class with static properties in the executable assembly.

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