Performance of VB.net to traverse is very bad , worse than the same code in VBA, how to improve?

Hey Guys,

As the topic mentioned, when I used the VB.net code to traverse the assembly design tree for all components on a 309-components assembly, it took around 36 seconds to finish, however, it is very fast on VBA, just like a flash.

Just don't know why, and I want to improve it on VB.NET , cause there is a project I have to use VB.NET.

I attached the demo video and samples with source code to it, hope any one could give some advice.

Thank you.

Vincent

SolidworksApi/macros