I have a scenario like the following, I have an enum, I get some text which is parsed to create a list of enums which I want to pass into ReportResults which will create an email based on the flags passed in. I don't have access to change the enum or the ReportResults method, is there a way to pass in something like the resultFlags variable? Is there a way to use an Enum.TryParse to create a single item to pass in? (there must be times where serialization requires something like this)
[Flags]
public enum Result
{
None = 0,
Warning = 2,
Error = 4,
Success = 8,
Failure = 16
}
public void ProcessResultValues(string log)
{
var resultFlags = new List<Result>();
/// Process log text, add Result flags to the resultFlags list
ReportResults(resultFlags);
}
public void ReportResults(Result results)
{
/// Based on the flags, generate a text to describe if the process succeeded or failed and if there were any warnings or errors encountered during processing.
}