检查的最佳方式,如果查询字符串是一个int? [英] The optimal way to check if a query string is an int?
本文介绍了检查的最佳方式,如果查询字符串是一个int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是来到了我的同事们心中的一个一个问题,什么是检查查询字符串是一个int的最佳途径。我建议采用经典的Int.Parse和尝试,渔获物,也的TryParse建议。其实我想不出任何其他方式。任何想法?
A question that came to one of my colleagues mind, what is the best way to check if a query string is an int. I suggested using the classic Int.Parse and try and catch, also TryParse was suggested. Actually i can't think of any other ways. Any ideas?
推荐答案
<一个href=\"http://msdn.microsoft.com/en-us/library/system.int32.tryparse.aspx\"><$c$c>Int32.TryParse$c$c>将是你最好的选择。
Int32.TryParse
is going to be your best bet.
这篇关于检查的最佳方式,如果查询字符串是一个int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文