Danny Ellis Jr. Danny Ellis Jr. - 4 months ago 10
Vb.net Question

What is this? CStr("DELETE")

I'm currently working on an older VB.Net project, and I'm finding hundreds of places where either string literals or string variables are being CStr'd. It is also being done with Ints as well. Is there some value to this that I am unaware of? Is this an actual operation that costs processing power?

Thanks in advance.

Uno Uno

CStr on a string is completely redundant, and not harmful.

I built a file:

Sub Main()
   Dim result = CStr("string")

End Sub

and the compiler was clever enough to replace CStr("string") with "string" if you have a look at the disassembled assembly with ILSpy.