Search
Winners

Win Prizes

Social Presence
Like us on Facebook
Advertisements
Ads

Solve function X

Pbethi1984
Posted by Pbethi1984 under Design Pattern & Practices on 4/6/2012 11:19:08 AM | Points: 75 | Views : 4787 | Status : [Member]

Please any one of  you answer the below question .

 

1.       Analyse FunctionX (Below) and describe what the function does.

    'InputParam is a collection of integers

    Public Function FunctionX(ByVal InputParam As Collection) As Integer

        Dim returnVal As Integer

 

        If (InputParam.Count > 0) Then

 

            'The enumerator object allows you to traverse the collection

            Dim collectionEnum As IEnumerator

            collectionEnum = InputParam.GetEnumerator()

 

            Dim int1 As Integer = 0

            Dim int2 As Integer = 0

            While (collectionEnum.MoveNext())

 

                int2 = CType(collectionEnum.Current, Integer)

 

                If int2 > int1 Then

                    int1 = int2

                End If

 

            End While

 

            returnVal = int1 + 1

        Else

            returnVal = 0

        End If

        Return returnVal

    End Function

 



Comments or Responses


Login to post response