Ercan Erdoğan
Oct 16, 2024

--

What if the underlying collection is mutable (e.g., List<T>), we can cast it to the original type and modify it.

like below:

if (numbers is List<int> numberList)

{

numberList.Add(4);

numberList.Remove(2);

}

--

--

Responses (1)