How to validate yield return default in IEnumerable?
问题 I am trying to check whether IEnumerable<> is null or empty but somehow my if check always fails whenever it is empty. private bool Update() { IEnumerable<RecordHolder> recordHolders = GetData(); // below check doesn't work if (recordHolders == null || !recordHolders.Any()) return false; // .. some other code } public IEnumerable<RecordHolder> GetData() { var isSuccess = PullRemote(url); if (!isSuccess.Result) { yield return default; } // .. some other code } Whenever my GetData() method