I have a list of strings called parentRows which contains strings that look like this:
"176,c-4454"
"177,c-34324"
I've used .split(',') to put them in a string[]
var arr = parentRow.Split(',');
because essentially what I want is that when I loop through the list, if the user input matches arr[1], then I want to convert arr[0] to an int and store it in the user's information.
Code snippet:
if (p.ParentCode != "")
{
foreach(var parentRow in parentRows)
{
var arr = parentRow.Split(',');
if(arr[1] == p.ParentCode)
{
int asInt = arr[0].Select(s => int.Parse(s));
}
}
}
as you can see I've tried int asInt = arr[0].Select(s => int.Parse(s));
but I just get the error
"Error CS1503 Argument 1: cannot convert from 'char' to 'System.ReadOnlySpan<char>"
How would one go about achieving what I want?
Thank you in advance!