[Gambas-user] Another Best Approach Question: Statistics over an array of objects
Tobias Boege
taboege at ...626...
Thu Aug 8 13:21:33 CEST 2013
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.
More information about the User
mailing list