Question: I'm trying to take objects out of an object list to an int list. If the object list's value contains a string than I want to convert it to an int. the error that I'm getting is "cannot convert from 'object' to 'System.ReadOnlySpan'. I've tried looking up examples and information about lists made of objects but couldn't find anything. 

I'm also at a loss as to what to do with the 'else' part of the code.

```
public class ListFilterer
{
   public static IEnumerable(int) GetIntegersFromList(List(object) listOfItems)
   {

      List<int> Integers = new List<int>();

      foreach (var value in listOfItems)
      {
        int number = 0;

        bool success = Int32.TryParse(value, out number);

        if (success)
        {
          Integers.Add(number);
        }
        else
        {
          Integers.Add(number);
        }
      }
      return Integers;

   }
}

```

Answer: 
It'll probably work out if you TryParse `value.ToString()` instead, if you're looking for anything that might look like an int and can be converted to an int. If you only want things that actually are ints, something like `if(value is int number)` should work if your c# version is recent. If it's older you may have to `if(value is int)` and then cast the value inside the if

Your code can be simplified to:

```
foreach(...){

  int.TryParse(value.ToString(), out var n);
  integers.Add(n);

}

```

Or

foreach(...){

```
  if(value is int)
    integers.Add((int)value);
  else 
    integers.Add(0);
}

```
If Try Parse fails number is automatically 0 so you can directly write this 

```
 Int32.TryParse(value, out int number)
 Integers.Add(number);

```