why not CLS compliant?

S

Smokey Grindle

Why is it when you put an enumeration as a return type it comes back as
non-cls compliant?

ex:

Public Property Test() As People.NamePrefix

Get

End Get

Set(ByVal value As People.NamePrefix)

End Set

End Property



where nameprefix is

Namespace People

''' <summary>

''' Prefix for a person's name

''' </summary>

''' <remarks></remarks>

Public Enum NamePrefix

MR

MS

Miss

Mrs

DR

End Enum

End Namespace



thanks!
 
R

rowe_newsgroups

Why is it when you put an enumeration as a return type it comes back as
non-cls compliant?

ex:

Public Property Test() As People.NamePrefix

Get

End Get

Set(ByVal value As People.NamePrefix)

End Set

End Property

where nameprefix is

Namespace People

''' <summary>

''' Prefix for a person's name

''' </summary>

''' <remarks></remarks>

Public Enum NamePrefix

MR

MS

Miss

Mrs

DR

End Enum

End Namespace

thanks!


I'm not getting any errors or warning when I do this in a new Windows
Application project:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MsgBox(Test.ToString())
End Sub

Private _Test As People.NamePrefix
Public Property Test() As People.NamePrefix
Get
Return _Test
End Get
Set(ByVal value As People.NamePrefix)
_Test = value
End Set
End Property

End Class

Namespace People

''' <summary>
''' Prefix for a person's name
''' </summary>
''' <remarks></remarks>
Public Enum NamePrefix
MR
MS
Miss
Mrs
DR
End Enum

End Namespace

Perhaps you could share some more code?

Thanks,

Seth Rowe
 
S

Smokey Grindle

thats all it takes to cause it... I create a brand new project put that
property in a form and add that enumeration and bang CLS warrning...
 
R

rowe_newsgroups

thats all it takes to cause it... I create a brand new project put that
property in a form and add that enumeration and bang CLS warrning...

Did it also generate it in the code I posted? Also are you using 2003
or 2005?

Thanks,

Seth Rowe
 
S

Smokey Grindle

yeah code just like that, VS2005 SP1 here... I just cant figure out why its
doing it, doesn't fit any of the CLS rules I have read
 
R

rowe_newsgroups

yeah code just like that, VS2005 SP1 here... I just cant figure out why its
doing it, doesn't fit any of the CLS rules I have read

That's very odd, I'm not getting anything here - I'm also using
2005sp1.

Thanks,

Seth Rowe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top