I've tried a few things like Modifiers?.Select and String.Join amongst some other things. "Modifiers" here is a list of objects that have an int called Level and an enum for the Id. It's for a game that I'm fiddling around with in Unity.
The following code works fine as long as the list isn't empty, which it frequently will be.
Also - for reference, I got the structure for this line from this question: String.Join on a list of objects
Edit I forgot to mention that the error I'm getting is ArgumentNullException: Value cannot be null. If the list is empty.
public int Hash => $"{Id}.{String.Concat(Modifiers.Select(i => i.Id))}".GetHashCode();