using System.Collections.Generic;
public static void Main()
string errorCodeMatched = string.Empty;
string errorDescription = string.Empty;
string errorCodeList = "Illegal_Argument";
string[] errorCodeLists = errorCodeList.Split('|');
List<Error> errors = new List<Error>
new Error {Code = "Illegal", Description = "Description1"},
new Error {Code = "Illegal_Code", Description = "Description2"},
new Error {Code = "Illegal_Value", Description = "Description3"}
errors.ForEach(error => {
if (errorCodeList.ToUpper().Contains(error.Code.ToUpper()))
errorCodeMatched = error.Code;
errorDescription = error.Description;
Console.WriteLine(isRetry + " - " + errorCodeMatched + " : " + errorDescription);
public string Code {get; set;}
public string Description {get; set;}