[Gambas-user] Another Best Approach Question: Statistics over an array of objects

Bruce bbruen at ...2308...
Sat Aug 10 09:21:14 CEST 2013


On Thu, 2013-08-08 at 13:21 +0200, Tobias Boege wrote:
> On Thu, 08 Aug 2013, Tobias Boege wrote:
> > Public Sub Analysis(iCat As Integer, aObjs As Object[]) As Analysis[]
> >   Dim aResult As New Analysis[]
> >   Dim hAnalysis As Analysis
> >   Dim sProp As String
> >   Dim hObject As Object
> >   Dim iValue As Integer
> > 
> >   ' Get the names of all properties in the objects which are associated with
> >   ' the given category (as a String[])
> >   For Each sProp In aObjs[0].AssociatedProperties(iCat)
> >     hAnalysis = New Analysis
> >     hAnalysis.Name = sProp
> > 
> >     For Each hObject In aObjs
> >       iValue = Object.GetProperty(hObject, sProp)
> >       ' Do the math
> >     Next
> >     aResult.Add(hAnalysis)
> >   Next
> >   Return hAnalysis
> > End
> 
>     Return aResult
> 
> would be the correct Return statement here.
> 
Thanks Tobi,

The Object.GetProperty was the clue I needed!

regards
Bruce






More information about the User mailing list