Tuesday, August 14, 2012

New cannot be used on a type parameter that does not have a new constraint

This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/new-cannot-be-used-on-type-parameter/

2 comments:

  1. Private Sub GenericMethod(Of T As MyType {New})(parameter1 As Integer) does not work. ???

    ReplyDelete
    Replies
    1. I am not 100% sure about this, but try including your type into the set and separating the types by commas.

      Private Sub GenericMethod(Of T As {MyType, New})(parameter1 As Integer)

      Delete

Note: Only a member of this blog may post a comment.