日期:2014-05-20  浏览次数:21236 次

List<string> 元素丢失 问题
代码如下

        private static List<string> uploadList = new List<string>();
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "TXT文件|*.txt";
            openFileDialog1.Title = "请选择要导入的文件";
            this.openFileDialog1.FilterIndex = 2;
            this.openFileDialog1.RestoreDirectory = true;
            string inFilePath;
            
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                inFilePath = openFileDialog1.FileName;
                uploadList = Untity.ReadTxt(inFilePath);//这里获取到的uploadList.Count = 28800
            }
            MessageBox.Show("加载成功!");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (uploadList.Count == 0)
            {
                MessageBox.Show("上传的QQ列表为空!");
                return;
            }
            bool isAdvancedClick = cListBoxAdvanced.CheckedItems.Count!= 0 ? true : false;
            bool isSecondaryClick = cListBoxSecondary.CheckedItems.Count != 0 ? true : false;
            advanced_property checkAdvanced = isAdvancedClick ? cListBoxAdvanced.CheckedItems[0] as advanced_property : null;
            secondary_property checkSecondary = isSecondaryClick ? cListBoxSecondary.CheckedItems[0] as secondary_property : null;
            int pageCount = uploadList.Count/1000;  //pageCount = 28
            int pageIndex = 1;
            int pageSize = 1000;