为什么我的函数不符合 CLS?
我收到以下警告消息...
函数“ConnectionNew”的返回类型不符合 CLS。
...对于此功能:
Public Function ConnectionNew(ByVal DataBaseName As String) As MySqlConnection
Dim connection As MySqlConnection = Nothing
connection = getConnection(DataBaseName())
Return connection
End Function
此消息是什么意思,我该如何修复它?
I'm getting the following warning message...
Return type of function 'ConnectionNew' is not CLS-compliant.
...for this function:
Public Function ConnectionNew(ByVal DataBaseName As String) As MySqlConnection
Dim connection As MySqlConnection = Nothing
connection = getConnection(DataBaseName())
Return connection
End Function
What does this message mean, and how can I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您返回的对象类型不符合 CLS。你对此无能为力,你没有编写类型。只需承认您知道它不合规,否则它不太可能导致任何问题。除非您在不支持所有 .NET 类型的另一种语言中使用该函数。使固定:
It is because you are returning an object of a type that's not CLS compliant. Nothing you can do about that, you didn't write the type. Just acknowledge that you know that it isn't compliant, it isn't otherwise likely to cause any problems. Unless you use the function in another language that doesn't support all the .NET types. Fix: