日期:2014-05-16  浏览次数:21033 次

如何知道 string[] 里有多少个数组
string[] fileName = openFileDialog.FileNames;

说白了就是想获取打开了多少个文件
------解决方案--------------------
http://msdn.microsoft.com/zh-cn/library/system.array.length.aspx
------解决方案--------------------
fileName.length
------解决方案--------------------
调用 fileName.length 属性
------解决方案--------------------

  openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Multiselect = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string[] files = openFileDialog1.FileNames;
                int i = files.Length; 

            }

------解决方案--------------------
.Count()
.GetLength(0)
.Length

都可以
------解决方案--------------------
fileName.Count();
fileName.Lenght;
这2个是用的最多的吧!至少是我用的最多的 
------解决方案--------------------
fileName.Length