How should I cast in VB.NET?
Asked 07 September, 2021
Viewed 1.7K times
  • 66
Votes

Are all of these equal? Under what circumstances should I choose each over the others?

  • var.ToString()

  • CStr(var)

  • CType(var, String)

  • DirectCast(var, String)


EDIT: Suggestion from NotMyself

  • TryCast(var, String)

7 Answer