tags:

views:

70

answers:

2

I wrote a generic EventArgs class in my VB.NET solution:

Public Class EventArgs(Of T)
        Inherits EventArgs

    Private _eventData As T

    Public ReadOnly Property EventData() As T
        Get
            Return _eventData
        End Get
    End Property

    Public Sub New(ByVal data As T)
        _eventData = data
    End Sub
End Class

When I use it as in the following example, it says that e is not CLS-compliant. Anyone know how to get around this, or at least can explain why this happens?

Event MarketModeChanged(ByVal sender As Object, ByVal e As EventArgs(Of Integer))
A: 

Add <Assembly: CLSCompliant(True)> to the assembly that defines the type, or add <CLSCompliant(True)> to the type itself.

SLaks
+1  A: 

There doesn't appear to be anything wrong with what you've done, afaik. Your generic event args class is public, which means if you didn't mark the assembly as cls compliant (add <Assembly: CLSCompliant(True)> to your assemblyinfo.vb file) you'll get this warning if you try and use this type in other projects.

Will