Ich habe dieses Stück Code hier:C# Zeichenfolge zum Floaten?
int i = 0;
StreamReader re = File.OpenText("TextFile1.txt");
string input = null;
while ((input = re.ReadLine()) != null)
{
string[] sites = input.Split(' ');
for (int j = 0; j < sites.Length; j++)
{
MyArray[i, j] = Convert.ToInt32(sites[j]);
}
i++;
}
for (int a = 0; a < 5; a++)
{
for (int j = 0; j < 5; j++)
{
Console.Write(MyArray[a, j] + " ");
}
Console.WriteLine();
}
Mein Problem ist, diese Zeile Code
MyArray[i, j] = Convert.ToInt32(sites[j]);
Sein in einen int umgewandelt zu werden, wie ich es in einem float-Format konvertieren?
Float [,] MyArray = neuer Float [5, 5]; MyArray [i, j] = Convert.ToSingle (Seiten [j]); –