Checking the C # VB.NET object for null gives an unexpected compilation error:
Recommended Resharper Solution:
I have a colleague who did this a year later without any problems. My colleague uses Visual Studio 2012, and I use Visual Studio 2013. Could it be some kind of settings?
Why basePackage != null a object ?
I know that VB.NET has Nothing , where C # has null .
UPDATE: BasePackage inherited this from another class: I don't know if this helps anyway.
Public Shared Operator =([object] As CMSObject, type As System.Type) Return [object].GetType Is type End Operator Public Shared Operator <>([object] As CMSObject, type As System.Type) Return [object].GetType IsNot type End Operator Public Shared Operator =([object] As CMSObject, o As Object) Return [object].GetType Is o End Operator Public Shared Operator <>([object] As CMSObject, o As Object) Return [object].GetType IsNot o End Operator
SOLUTION: When I exit these two statements, C # works fine again.
Public Shared Operator =([object] As CMSObject, type As System.Type) Return [object].GetType Is type End Operator 'Public Shared Operator <>([object] As CMSObject, type As System.Type) ' Return [object].GetType IsNot type 'End Operator Public Shared Operator =([object] As CMSObject, o As Object) Return [object].GetType Is o End Operator 'Public Shared Operator <>([object] As CMSObject, o As Object) ' Return [object].GetType IsNot o 'End Operator
Final Solution Added Type to VB.NET. Then there is no need for C #.
Public Shared Operator =([object] As CMSObject, type As System.Type) **As Boolean** Return [object].GetType Is type End Operator Public Shared Operator <>([object] As CMSObject, type As System.Type) **As Boolean** Return [object].GetType IsNot type End Operator Public Shared Operator =([object] As CMSObject, o As Object) **As Boolean** Return [object].GetType Is o End Operator Public Shared Operator <>([object] As CMSObject, o As Object) **As Boolean** Return [object].GetType IsNot o End Operator