Question

I'm currently using Red Gate's Performance Profiler to optimize an application. I keep running across a declaration generated by VS and always takes around a second to declare. Its being set to null too. I don't understand why this takes a second to do. I know VS Designer can use this for some components but is there anyway to reduce the number of these declarations? An explanation of why this happens would be great too.

profilerScreenshot

Was it helpful?

Solution

That is a field initializer. The profiler may be measuring the initialization of the entire class at that line. Try setting the field to null within the constructor instead to see if there is a difference in times.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top