.Net Parse versus Convert

后端 未结 5 502
失恋的感觉
失恋的感觉 2020-12-17 16:23

In .Net you can read a string value into another data type using either .parse or Convert.To.

I\'m not fam

5条回答
  •  不思量自难忘°
    2020-12-17 17:17

    If you need speed, I'm pretty sure a direct cast is the fastest way. That being said, I normally use .Parse or .TryParse because is seems to make things easier to read, and behave in a more predictable manner.

    Convert actually calls Parse under the hood, I believe. So there is little difference there, and its really just seems to be a matter of personal taste.

提交回复
热议问题