[quote user="HDR_Coder"]ForEachModel InActiveDesignFile.Models[/quote]
[quote user="HDR_Coder"]foreach(ModelReference model innewapp.ActiveDesignFile.Models)[/quote]
Is it an issue with temporary object lifetimes, or other misuse of the class? There's a note in VBA help: You cannot use the New keyword to create a ModelReferences object. Unfortunately, C# pays no attention to certain COM qualifiers such as noncreatable.
The VBA iterator uses property ActiveDesignFile.Models. Nothing new or temporary is created.
The C# iterator creates an anoymous temporary variable to store the result of newapp.ActiveDesignFile.Models. As a new, unitialised, variable it contains no data. What happens if you use the VBA idiom in C#?
foreach (ModelReference model in app.ActiveDesignFile.Models)