无法解析并获得退货 [英] Trouble parsing and getting the returns

查看:58
本文介绍了无法解析并获得退货的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!这是一些代码:

Hey everyone! Here's some code:

                try
                {
                    string[] dirs = Directory.GetDirectories(@"c:\testing\", "*" + dirSearch + "*", SearchOption.AllDirectories);

                    foreach (string dirName in dirs)
                    {
                        Console.WriteLine(dirName);
                        var names = dirName.Split(new[] { @"\" }, System.StringSplitOptions.RemoveEmptyEntries);
                        Console.WriteLine(names[3]);
                        Console.WriteLine(names[4]);
                        listBox8.DataSource = names[3].ToList();
                    }
                }
                catch
                \\show some message

因此,当我运行此消息时,除了它将名称[3]的东西一次性作为单个字母返回。像这样:

So when I run this, it's sorta working except that it's returning the names[3] thing as a single letter at a time. Like this:

d

e

m

o

n

s

t

r

a

t

e

而不是仅仅返回:

演示

我在这里做错了什么?

推荐答案

这可以帮到你

试试

listBox8.DataSource = new List<string> { names[3] };


这篇关于无法解析并获得退货的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆