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.
CStr on a string is completely redundant, and not harmful.
I built a file:
Sub Main() Dim result = CStr("string") Console.WriteLine(result) 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.