Coding Horror posted by:
Pbethi1984 | Posted on: 4/6/2012 | Category:
Pattern and Practices | Views: 1969 | Level:
Starter | Status:
[Member] |
Points: 75
|
Alert Moderator
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
Found interesting? Add this to: