I want to find a value in a custom List based on a couple criterias.
public class BlockData {
public int x { get; set;}
public int y { get; set;}
public int z { get; set;}
public byte blockType { get; set;}
public Chunk blockData { get; set;}
public BlockData(int x, int y, int z, byte blockType, Chunk blockData)
{
this.x = x;
this.y = y;
this.z = z;
this.blockType = blockType;
this.blockData = blockData;
}
}
And I’d initialize it with data = new List();.
Let’s say I’ve added some data in it.I can do:
world.data.FirstOrDefault(myItem => myItem.x == 5).blockData.update = true;
For example to get the first item with the x variable being 5. But how do I get something like an X Y Z in this case? Aka more then one. I’ve tried something like:
world.data.FirstOrDefault(myItem => myItem.x == updateX myItem.y == updateY myItem.z == updateZ).blockData.update = true;
But this doesn’t work. It returns to me that it didn’t find anything but I believe the current data in the field is correct. What can I do to adjust this so that it gives me the data I need based on an X Y and Z? Is this the proper way, or is there another way/more efficent way of finding data in a List using more the one search variable?