这真是困惑我...变量设置为相同的值?
t1 = data;//adds the recieved data to the variable
read = false;//this tells IR
Console.WriteLine("Press " + name + " again (" + (2) + "/8)");
recieve();
t2 = data;//adds the recieved data to the variable
read = false;//this tells IR
Console.WriteLine("Press " + name + " again (" + (3) + "/8)");
recieve();
t3 = data;//adds the recieved data to the variable
read = false;//this tells IR
Console.WriteLine("Press " + name + " again (" + (4) + "/8)");
recieve();
t4 = data;//adds the recieved data to the variable
read = false;//this tells IR
这是我的脚本的一部分,这个问题是与T1,T2,T3,T4的变量。 'receive'方法改变'data'的含义。
当我运行带断点的代码时,我可以首先看到t1 = 1。那么当它达到't2 = data'时,t2等于4,但t1也是如此在这段代码t1的末尾,t2和t3等于t4,但它们都应该是唯一的。为什么是这个,我该如何解决它?
t1,t2,t3和t4的数据类型是什么?你也可以显示你的receive()方法吗? – displayName
是的,有趣的是什么是数据类型的t1等,如果这些是值类型,这不应该发生 –
“拿出其余的代码来实现特定的行为”类型的问题通常很难回答(也有趣) - 请尝试提供完整(但很小)的代码来演示问题并询问为何发生问题。 –