質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top