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 50 51 52 53 54 55 56 57 58 59 60 61
|
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
public enum enErrorLevel
{
none,
warning,
simple,
critical
}
public struct stErrorManager
{
public bool bErrorOccured;
public enErrorLevel iErrorLevel;
public string sErrorDescription;
public stErrorManager(bool errorOccured, enErrorLevel errorLevel, string errorDescription)
{
bErrorOccured = errorOccured;
iErrorLevel = errorLevel;
sErrorDescription = errorDescription;
}
}
class Program
{
static void Main(string[] args)
{
List<stErrorManager> listeErrors = new List<stErrorManager>();
try
{
int a = int.Parse("a");
}
catch (Exception ex)
{
listeErrors.Add(new stErrorManager(true, enErrorLevel.simple, ex.Message));
}
try
{
int a = int.Parse("bb");
}
catch (Exception ex)
{
listeErrors.Add(new stErrorManager(true, enErrorLevel.critical, ex.Message));
}
foreach (stErrorManager em in listeErrors)
{
Console.WriteLine("Erreur {0} - Message : {1}", em.iErrorLevel, em.sErrorDescription);
}
Console.ReadKey();
}
}
} |
Partager