I'm not sure how to phrase this exactly. I have a class, called BoundedString, which basically looks like:
Public Class BoundedString
Public Property Value() As String
Public Property MinLength() As Integer
Public Property MaxLength() As Integer
End Class
Elsewhere in my code, I want to be able to say:
Public Class SomeClass
Public Property StringField() As BoundedString(Of 3, 5)
End Class
Where 3 and 5 represent the values of MinLength and MaxLength.
This way, I can statically specify info about my string. The closest thing I've found to this seems to be generics or maybe attributes, but I don't think generics let you specify concrete values. Is anyone aware of a language feature for doing this?
Aucun commentaire:
Enregistrer un commentaire