Ich habe ein Programm geschrieben.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Converter
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Dateiname:");
string filename=Console.ReadLine();
StreamReader Sreader = new StreamReader(filename+ ".txt");
StreamWriter Swriter = new StreamWriter(filename + @"_new.txt");
while (!Sreader.EndOfStream)
{
string @email = @Sreader.ReadLine();
string[] @parts = @email.Split('@');
string @hoster= @parts[1];
if (hoster == "web.de" || hoster == "gmx.de" || hoster == "gmx.net" || hoster == "googlemail.com" || hoster == "gmail.com" || hoster == "yahoo.com"
|| hoster == "t-online.de" || hoster == "arcor.de" || hoster == "arcor.com" || hoster == "ymail.com" || hoster == "freenet.de" || hoster == "rocketmail.com"
|| hoster == "aol.de" || hoster == "yahoo.de"|| hoster == "hotmail.de" || hoster == "hotmail.com" || hoster =="live.de" || hoster == "aol.com"
)
{
Swriter.WriteLine(email);
}
}
Sreader.Close();
Swriter.Close();
}
}
}
Source erklärt alles.
Nun sagt mir mein Compiler:
Der Index war außerhalb des Arraybereichs.
Source lässt sich fehlerfrei Compilieren.
Bitte um Hilfe
mfg