Why is this returning an empty string?

I have this global method in a module:

Sub AppendLine( Extends s as String, text as String ) s = s + text + EndofLine End Sub

If I call it from my project like this:

dim myString as String = "Hello " myString.AppendLine( "World" )

The value of myString is "Hello " instead of “Hello World”. Am I overlooking something very simple here?

Your sub isn’t returning anything… if you want to modify the string in place try byref
Extends byref s as String

@jim mckay
Doh! That’s why one shouldn’t code after New Years Eve!

Thanks.

@jim mckay
Doh! That’s why one shouldn’t code after New Years Eve!

Thanks.

Don’t feel bad. Your code would have worked for just about everything but a string. Strings are immutable.