PDA

View Full Version : Strano errore C#


HipT
18-01-2008, 14:35
Ciao a tutti.
Sto facendo un programma in C#.
Però mi sono fermato subito perchè mi da' un errore strano:confused: .

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace compr_1
{
class Program
{
static void Main(string[] args)
{
int counter = 0;
string ing;
string s1;
int i=0;

System.IO.StreamReader file = new System.IO.StreamReader("c:\\test.txt");
while ((ing = file.ReadLine()) != null)
{
for (int c1 = 0; c1 < ing.Length; c1++)
{
i=0;
s1[c1] = ing[c1];
if (ing[c1] == ' ')
{
}
}
Console.WriteLine(ing);
counter++;
}

file.Close();

// Suspend the screen.
Console.ReadLine();
}
}
}

Mi sono fermato prima di andare avanti perchè mi da' quest'errore:


Impossibile assegnare un valore alla proprietà o all'indicizzatore 'string.this[int]' perché è in sola lettura

Sinceramente un errore simile non mi è mai capitato...
Cosa potrebbe essere?
Grazie.

isAlreadyInUse
18-01-2008, 14:37
Chi sà perche lo hanno chiuso :confused:

HipT
18-01-2008, 14:43
Chi sà perche lo hanno chiuso :confused:

Cosa hanno chiuso?

cionci
18-01-2008, 14:51
Thread chiuso
|
V