Concat strings by & and + in VB.Net

后端 未结 8 813
萌比男神i
萌比男神i 2020-12-16 10:53

Is there any difference between & and + operators while concatenating string? if yes, then what is difference? And if No, then why below code generating exception?

8条回答
  •  囚心锁ツ
    2020-12-16 11:24

    You've probably got Option Strict turned on (which is a good thing), and the compiler is telling you that you can't add a string and an int. Try this:

    t = s1 & i.ToString()

提交回复
热议问题