✅ Array Assignment Error
I'm iterating over a list of classes, and in each class, there's a property that is an array which I iterate over and remove anything that matches what I want to remove. Originally, I did a .Where() for comparison and then .ToList() which I iterated over and did a Array.Clear on the original array. But that just leaves behind null classes in the Array.
So I changed my approach, converted the array to a list and did a remove all. I want to set the original Array equal to this List<T>.ToArray(), but when I try that, I get "the Left-hand side of an assignment must be a variable, property or indexer" error.
7 Replies
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Wondering if anyone can take a look at this.
what does the error message say?
CS0131: The left-hand side of an assignment must be a variable, property or indexer.
TheRanger#3357
REPL Result: Failure
Exception: CompilationErrorException
Compile: 526.995ms | Execution: 0.000ms | React with ❌ to remove this embed.
yea i dont think foo?.bar works
try instead
Yep, that was it! Now that I think about it, that makes sense. I appreciate the help