当字符串[],_ lineParts被添加到List时,我在List中看到的只是"System.String []"需要做什么来查看列表中的实际string []值.
while (_aLine != null)
{
//split the line read into parts delimited by commas
_lineParts = _aLine.Split(new char[] { ' ', '\u000A', ',', '.', ';', ':', '-', '_', '/' },
StringSplitOptions.RemoveEmptyEntries);
//keep things going by reading the next line
_aLine = sr.ReadLine();
//words = _lineParts;
if (_lineParts != null)
{
//_words.Add(_lineParts.ToString());
wrd.Add(_lineParts.ToString());
}
}
Run Code Online (Sandbox Code Playgroud) 我更新了我的ASP.NET MVC项目以包括表单验证 - Abide(foundation.abide.js),但是当我在表单中包含数据时,它会引发错误.我将它添加到基础文件夹中,该文件夹是我的布局视图中引用的脚本包的一部分.
@using (Html.BeginForm("CreateJourney", "Home", FormMethod.Post, new {@class = "custom", id="postJourneyForm", name="postJourneyForm", data-abide}))
Run Code Online (Sandbox Code Playgroud)
有人可以解释我错过了什么吗?是因为我只添加了javascript文件而没有别的吗?
当我加载窗体时,使用新线程,我每秒向列表框添加一个随机数,当它达到10个数字时,我生成一组10个随机数.但是,目前,我遇到了UI线程的问题.随机数被添加到列表框中,但我无法控制表单.当我尝试与表单进行交互时,UI会冻结.我是否错误地使用了MethodInvoker.任何意见,将不胜感激.
public Form1()
{
InitializeComponent();
Thread ranThread = new Thread(new ThreadStart(RandomList));
ranThread.IsBackground = true;
ranThread.Start();
}
public void RandomList()
{
stack = new Stack<int>();
while (loop)
{
if (lbxStackRndNum.InvokeRequired)
{
lbxStackRndNum.Invoke(new MethodInvoker(delegate
{
Random rnd = new Random();
if (lbxStackRndNum.Items.Count == 10)
{
stack.Clear();
lbxStackRndNum.Items.Clear();
}
int rndVal = rnd.Next(1, 10000);
stack.Push(rndVal);
lbxStackRndNum.Items.Insert(0, rndVal);
Thread.Sleep(1000);
}));
}
}
}
Run Code Online (Sandbox Code Playgroud)