I created an inherited version of the NameValueCollection, because I
wanted to include some overloads of the Get method. When I try and use
the collection, I get:
===============================
An unhandled exception of type 'System.TypeLoadException' occurred in
MyCode.Letter.
Additional information: Could not load type
MyCode.DataAccess.NVCollection from assembly MyCode.DataAccess,
Version=1.0.2454.19127, Culture=neutral, PublicKeyToken=null.
===============================
I don't understand why it's giving me this problem. Here's the entire
MyCode.DataAccess.NVCollection class:
===============================
Public Class NVCollection
Inherits System.Collections.Specialized.NameValueCollection
Public Overloads Overrides Function [Get](ByVal name As String) As
String
Dim str As String = MyBase.Get(name)
If str Is Nothing Then Return ""
Return str
End Function
Public Overloads Function [Get](ByVal name As String, ByVal
[default] As String) As String
Dim str As String = MyBase.Get(name)
If str Is Nothing Then Return [default]
If str = "" Then Return [default]
Return str
End Function
Public Overloads Function [Get](ByVal name As String, ByVal
[default] As Integer, ByVal min As Integer, ByVal max As Integer) As
Integer
Dim str As String = MyBase.Get(name)
If str Is Nothing Then Return [default]
If str = "" Then Return [default]
Dim r As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex("\d+")
Dim m As System.Text.RegularExpressions.Match = r.Match(str)
If Not m.Success Then Return [default]
If CInt(str) < min Or CInt(str) max Then Return [default]
Return CInt(str)
End Function
End Class
===============================
It could hardly be any simpler, but it's blowing up on me. Can anyone
explain why?
Thanks,
Lisa