Frankwangyifang

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
public static class ExtensionString
{
public static int ToInt(this string str)
    {
        int ret = 0;
        if (str != null && str.Length > 0)
        {
            str = str.Replace(",", string.Empty);
            int.TryParse(str, out ret);
        }
        return ret;
    }
}

public static int ToInt(this string str) //this 关键字的作用.
posted on 2009-11-10 13:30  Frankwangyifang  阅读(227)  评论(0编辑  收藏  举报