Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq C#-获取列表<;字节>;参考指数_Linq_List_Object_Reference_Compare - Fatal编程技术网

Linq C#-获取列表<;字节>;参考指数

Linq C#-获取列表<;字节>;参考指数,linq,list,object,reference,compare,Linq,List,Object,Reference,Compare,我有一张清单> List<List<Byte>> bytes = new List<List<Byte>>() { new List<Byte> {1, 1, 2, 3, 4}, // index 0 is original new List<Byte> {0, 0, 2, 4, 1}, new List<Byte> {1, 2, 2, 1, 1}, new List<Byte> {1, 0,

我有一张清单>

List<List<Byte>> bytes = new List<List<Byte>>()
{
 new List<Byte> {1, 1, 2, 3, 4}, // index 0 is original
 new List<Byte> {0, 0, 2, 4, 1},
 new List<Byte> {1, 2, 2, 1, 1},
 new List<Byte> {1, 0, 2, 2, 2}
};
一个人建议我先对未排序的列表使用引用,然后对列表进行排序,然后使用ReferenceEqual,但这对我不起作用。通过设置引用,我是做错了什么,还是列表中的引用不起作用?如何获取排序数组中的原始索引?另外,我正在和OrderBy和IComparer进行排序

以下是我尝试引用的方式:

List<byte> reference = new List<byte>(bytes[0]);
List<byte> reference = new List<byte>(bytes[0]);
List reference=新列表(字节[0]);
以下是我尝试引用的方式:

List<byte> reference = new List<byte>(bytes[0]);
List<byte> reference = new List<byte>(bytes[0]);

现在
reference
引用排序前位于零位的列表,因此您应该能够使用引用等式来查找其索引。

您是对的,我尝试的原因是,因为我在某些地方看到了如何处理对象,我认为处理列表的方式也会相同。非常感谢您快速准确的回答!:)