使用标志比较2个列表 [英] Comparing 2 lists using a flag
问题描述
我正在和一位曾经大量使用汇编语言工作的程序员交谈,并讨论比较2个列表,
他说了以下内容:
如果循环遍历第一个列表并找到一个文件,则检查第二个列表,如果它包含该文件,则返回true。他说你通过设置一个标志来做到这一点。他说可以在不使用IEnumerate或类似的东西的情况下完成。
我正在尝试编写这个想法并挣扎。
有没有人有一个想法如何做到这一点,它激起了我的好奇心,我已经将我的头撞在墙上好几天了。
每一行每个列表看起来都是这样的;
file1.txt = 476D090D306232BF14DB9AB37FFFF80E2F23A5E9
file2.txt = 476D099D306232BF14CB9AB37FFFF80E6F23A5E9
bool hasFile = false;foreach(list1中的文件fileName)
{
string file = list1.file
}foreach(文件fileName在list2)
{
CuriousCoder
为什么?为什么需要使用汇编语言技术和C#这样的语言?如果你想学习汇编语言的方法,那么使用 汇编语言。
什么是 汇编语言程序员可能会调用一个标志,C#程序员调用一个布尔值。如果需要多个州,那么C#有
枚举。
某些来自 IEnumerate的内容无法在没有 IEnumerate。在 汇编语言中,程序员可能会使用机器地址指向前一个和
的下一个对象;如果您不熟悉双向链表,那么请了解相关信息。或者 汇编语言程序员将使用一个数组,其中内存的连续位置中有多个实例。
Hi, I was talking to a programmer that used to work heavily in Assembly language and was discussing comparing 2 lists,
he said the following:
if you loop through the first list and find a file, you then check the second list and if it contains that file you return true. He said you do this by setting a flag. He said it can be done without using IEnumerate or anything like that.
I am trying to code that idea and struggling.
Does anyone have an idea how this can be done, it sparked my curiosity so much I've been banging my head against a wall for days.
each line in each list looks something like this;
file1.txt=476D090D306232BF14DB9AB37FFFF80E2F23A5E9
file2.txt=476D099D306232BF14CB9AB37FFFF80E6F23A5E9
bool hasFile = false;foreach(File fileName in list1) { string file = list1.file }
foreach(File fileName in list2)
{
CuriousCoder
Why? Why do you need to use assembly language techniques with a language like C#?If you want to learn Assembly language ways to do things then use Assembly language.
What an Assembly language programmer might call a flag, C# programmers call a Boolean. If more than one state is required then C# has enums.
Some things that derive from IEnumerate cannot be navigated without IEnumerate. In assembly language the programmer would likely use machine addresses to point to a previous and a next object; if you are unfamiliar with doubly-linked lists then learn about that. Or an assembly language programmer would use an array where there are multiple instances in contiguous locations of memory.
这篇关于使用标志比较2个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!