C# Nullable arrays
问题 I have a search function, but I would like LocationID to be an array of integers rather than just a single integer. I'm not sure how to do this since I want it to also be nullable. I've looked at doing int?[] but then I'd have to check the HasValue of every single entry. Is there a better way? This is what I currently have: public ActionResult Search(string? SearchString, int? LocationId, DateTime? StartDate, DateTime? EndDate) 回答1: Arrays are always reference types, as is string - so they're