using System;
using System.Collections.Generic;
using System.Linq;
#nullable enable
public class Program
{
public static void Main()
var list = new List<string?> {
null,
"hello",
"goodbye",
};
foreach (var word in list.OfType<string>()) {
Console.WriteLine(word);
}