我对处理解析文本信息的不同方法了解很多.例如,对于解析整数,可以期望什么样的性能.我想知道是否有人知道这方面的任何好的统计数据.我正在寻找一些经过测试的人的真实数字.
在哪些情况下,哪些提供最佳性能?
Parse(...) // Crash if the case is extremely rare .0001%
If (SomethingIsValid) // Check the value before parsing
Parse(...)
TryParse(...) // Using TryParse
try
{
Parse(...)
}
catch
{
// Catch any thrown exceptions
}
Run Code Online (Sandbox Code Playgroud)