Visio has some handy methods on the Shape object to retrieve a whole set of FormulaU's in the Shape's shapesheet at once, very good for improving performance across the .net interop to Visio.
Microsoft however says here:
"Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulasU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)"
This is very unclear for using Visio from a .NET VSTO add-in, and makes me wonder if I need to do something to trigger 'garbage collection' on the Array that is returned, or does .NET GC and the interop software layer Microsoft created to go from managed-to-unmanaged code take care of this for me? Thank you for sharing your insights in to this confusing subject (confusing because of the unclear official documentation).