System.ComponentModel.IContainer takes 1 sec to declare?

207 views Asked by At

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

1

There are 1 answers

2
Peter Ritchie On BEST ANSWER

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.