将字符数组转换成int数组

 private int[] GetIntArrayFromStr(string historyLeaderId)
        {
            var strArray= !string.IsNullOrEmpty(historyLeaderId) && historyLeaderId.Contains(",")
                       ? historyLeaderId.Split(',')
                       : new string[2] {"0", "0"};
            return Array.ConvertAll<string, int>(strArray, int.Parse);
        }

posted @ 2012-12-10 16:01  海之澜  阅读(510)  评论(0编辑  收藏  举报