using c#

将IList或List泛类型转换为数组

09-03-20 00:23   View:633


        /// <summary>
        /// 将Ilist<T>型转换为数组
        /// </summary>
        /// <returns></returns>
        protected string[] toBeSored()
        {
            IList<string> lst = new List<string>();
            lst.Add("a");
            lst.Add("b");
            lst.Add("c");
            string[] toBesorted = new string[lst.Count];
            for (int i = 0; i < lst.Count; i++)
            {
                toBesorted[i] = lst[i];               
            }
            return toBesorted;
        }

呵呵,很简单的类型转换


Feedback


  • No comments posted yet.
Title:
 
Name:
 
URL:

Comments:
 

Because of the cache,you may see your comments several minutes later.


Main Feeds

Contact Me Privacy

All Rights Reservered CnKker.Com 2006~2009 Powder By 龍天昌盛 QQ:256051