Когда я выполняю свой код в Visual Studio, он работает хорошо, но когда я выполняю свой exe-файл, он выдает исключение.
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at QuoteExtractor.frmQuoteExtractor.cmdProcess_Click(Object sender, EventArgs e)
Мой код
private void cmdProcess_Click(object sender, EventArgs e)
{
try
{
foreach (string line in rtfMain.Lines)
{
try
{
if (line.Trim() != "")
{
if ((line != "") && (line != " ") && (line.Substring(0, 3) != "***") && (line.Substring(0, 5) != "CUSIP"))
{
Quote q = new Quote();
q.Parse(line);
DisplayQuote(q);
QuoteList.Add(q);
}
}
}
Ввод:
*** 9:30 AM ***
CUSIP BOND NAME SIZE CURR FACE TALK COVER PX
004421GU1 ACE 2004-HE2 M2 10.000MM 1.103MM dnt, 90 rsrv
61744CTZ9 MSHEL 2005-3 M3 4.720MM 4.720MM dnt
Подробнее здесь: https://stackoverflow.com/questions/175 ... ocation-wi
System.ArgumentOutOfRangeException: индекс и длина должны относиться к местоположению внутри строки. ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
System.ArgumentOutOfRangeException при установке RadioButton IsChecked в MAUI
Anonymous » » в форуме C# - 0 Ответы
- 30 Просмотры
-
Последнее сообщение Anonymous
-