Implicit vs explicit conversions in VB.NET

126 views Asked by At

I have a project written in VB.NET that is part of a larger solution. My knowledge of VB.NET is extremely limited. This project generates hundreds of warnings concerning implicit conversions during a build.

Example: Implicit conversion from 'Object' to 'Integer':

enter image description here

Here, it complains that GetKey returns an Object and that's implicitly converted to Integer.

So I've added either a CType or a DirectCast.

enter image description here

Now, it says that the cast is redundant and I should remove it.

I'm confused. What should I do? I'd like to get rid of the compiler warnings.

0

There are 0 answers