vb.net documentation and exception question
Posted
by dcp
on Stack Overflow
See other posts from Stack Overflow
or by dcp
Published on 2010-06-09T03:49:06Z
Indexed on
2010/06/09
3:52 UTC
Read the original article
Hit count: 333
Let's say I have this sub in vb.net:
''' <summary>
''' Validates that <paramref name="value"/> is not <c>null</c>.
''' </summary>
'''
''' <param name="value">The object to validate.</param>
'''
''' <param name="name">The variable name of the object.</param>
'''
''' <exception cref="ArgumentNullException">If <paramref name="value"/> is <c>null</c>.</exception>
Sub ValidateNotNull(ByVal value As Object, ByVal name As String)
If value Is Nothing Then
Throw New ArgumentNullException(name, String.Format("{0} cannot be null.", name))
End If
End Sub
My question is, is it proper to call this ValidateNotNull (which is what I would call it in C#) or should I stick with VB terminology and call it ValidateNotNothing instead? Also, in my exception, is it proper to say "cannot be null", or would it be better to say "cannot be Nothing"?
I sort of like the way I have it, but since this is VB, maybe I should use Nothing. But since the exception itself is called ArgumentNullException, it feels weird to make the message say "cannot be Nothing".
Anyway, I guess it's pretty nitkpicky, just wondered what you folks thought.
© Stack Overflow or respective owner