I have a class as below.
public class PurgeRecord
{
public int Index { get; set; }
public string Source { get; set; }
public int PurgeFileID { get; set; }
public string AuthorisationID { get; set; }
public string RecordSystem { get; set; }
public string KeyName { get; set; }
public string[] KeyValues { get; set; }
public bool IsValid { get; set; }
public string Action { get; set; }
public string ErrorDetail { get; set; }
public string FileName { get; set; }
}
I am getting some string values separated by '|' into string array and lopping over it as follows.
string[] test = Convert.ToString(values[5]).Split('|');
foreach (string key in test)
{
purgeRecord = new PurgeRecord()
{
KeyValues = key,
IsValid = true,
FileName = "XYZ"
};
lstPurgeRecords.Add(purgeRecord);
}
But I am getting an error on key as cannot convert string to string[] implicitly. I tried many ways and tried googling as well but no luck.
Please help.