3.0.2 NameValueList Changes

3.0.2 NameValueList Changes

Old forum URL: forums.lhotka.net/forums/t/3670.aspx


JoeFallon1 posted on Monday, October 08, 2007

Rocky,

There was an item in the wish list for NVLB. I just checked the implementation and I am not sure if the right wish was implemented.

The code in 3.0.2 now has 2 methods which are essentially identical: (same thing for Value methods)

'Original method:
Public Function Key(ByVal value As V) As K
  For Each item As NameValuePair In Me
   
If item.Value.Equals(value) Then
     
Return item.Key
   
End If
 
Next
 
Return Nothing
End Function

'New method:
Public Function GetKey(ByVal value As V) As K
 
For Each item As NameValuePair In Me
   
If item IsNot Nothing AndAlso item.Value.Equals(value) Then
     
Return item.Key
   
End If
 
Next
 
Return Nothing
End Function

In my NVL Base class I added what I thought were the 2 methods on the wish list:

Public Function GetItemByKey(ByVal key As K) As NameValuePair
 
For Each item As NameValuePair In Me
   
If item IsNot Nothing AndAlso item.Key.Equals(key) Then
     
Return item
   
End If
 
Next
 
Return Nothing
End Function

Public Function GetItemByValue(ByVal value As V) As NameValuePair
 
For Each item As NameValuePair In Me
   
If item IsNot Nothing AndAlso item.Value.Equals(value) Then
     
Return item
   
End If
 
Next
 
Return Nothing
End Function

Please comment.

Joe

JoeFallon1 replied on Tuesday, October 09, 2007

Bump.

RockfordLhotka replied on Tuesday, October 09, 2007

Looks like a bug to me.

Copyright (c) Marimer LLC