1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
using System;
using System.Collections.Generic;
using System.IO;
namespace TestFichierList
{
class Program
{
static void Main(string[] args)
{
List<Ligne> lignes = new List<Ligne>();
using (StreamReader paramconfig = new StreamReader(@"C:\in\test.txt"))
{
string chaquelignes;
while ((chaquelignes = paramconfig.ReadLine()) != null)
{
if (chaquelignes.StartsWith("#")) //Un commentaire = ligne suivante
{
continue;
}
lignes.Add(new Ligne(chaquelignes));
}
}
foreach (Ligne ligne in lignes)
{
Console.WriteLine(ligne.ToString());
}
Console.ReadLine();
}
}
class Ligne
{
public string str;
public string youpitralala;
public Ligne(string st)
{
str = st;
youpitralala = "DTC";
}
public override string ToString()
{
return string.Format("{0} {1}", youpitralala, str);
}
}
} |