Reputation: 466
I'm getting a byte list into my method. Now I need the byte list reversed and non-reversed. I've tried this:
public void Test(List<Byte> dataList)
{
List<byte> reversedDataList = dataList;
reversedDataList.Reverse();
_polls = dataList[0];
_rpolls = reversedDataList[0]
}
The problem is, that both lists are reversed. How can I solve that?
Upvotes: 2
Views: 94
Reputation: 101681
Add ToList
after dataList
to create a copy of your list:
List<byte> reversedDataList = dataList.ToList();
Upvotes: 5