获得参数id的Long值,如果找不到或格式不正确,返回0 - GetLongIDParameter

2017-05-16 09:04:08  访问(1403) 赞(0) 踩(0)


        /// <summary>
        /// 获得参数id的Long值,如果找不到或格式不正确,返回0 - GetLongIDParameter
        /// </summary>
        /// <returns></returns>
        public static long GetLongIDParameter()
        {
            string theValue = HttpContext.Current.Request.QueryString["id"];

            if (theValue == null || theValue.Length == 0)
                return 0;

            long theResult = 0;

            if (long.TryParse(theValue, out theResult))
                return theResult;

            return 0;
        }


标签:获得参数id的Long值,如果找不到或格式不正确,返回0 - GetLongIDParameter 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)