Makes sense. The mod 32 is a good idea because if you pass in 360 (which is what I think you meant to write) you actually get 32 returned, which is not a value in the enum. That is better then the way I did it with adding the extra one.
For validation, I have this:
Code:
Public Class Direction
Private _course As Double
Public Sub New(ByVal course As Double)
Me.Course = course
End Sub
Public Property Course() As Double
Get
Return _course
End Get
Set(ByVal value As Double)
If value > 360 Then Throw New ArgumentOutOfRangeException("Course cannot be greater than 360.")
If value < 0 Then Throw New ArgumentOutOfRangeException("Course cannot be less than 0.")
_course = value
End Set
End Property
End Class
Thanks again,
Stephen