Why is calling StringCollection from settings slow?

I am writing a small .NET Windows Forms application, and I use Visual Studio's built-in settings to control the configuration of my programs. However, I noticed that after I added the StringCollection parameter (to save a list of recently received documents), my program took a lot more time to run.

I started StopWatch to initialize the programs and found that even when StringCollection was called, the startup time from 100 milliseconds to 300 milliseconds took. I know, probably, that you will say that 200 milliseconds between friends ?, but it seems strange to me that something so simple can cause such a delay.

So my question is: why are you calling StringCollection from settings so slowly, and is there any way to avoid this delay?

+3
source share
2 answers

You may need to download additional assemblies that otherwise would not have been needed for longer.

You can use the call Console.ReadLine()immediately before loading the parameters and see which assemblies will be loaded after that, when you run it in Visual Studio to test this theory.

+3
source

This happened the first time you started the program, as well as during subsequent launches (without rebuilding between them). Also, was it a release build?

+1
source

Source: https://habr.com/ru/post/1712720/


All Articles