本文整理汇总了C#中Struct.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Struct.Equals方法的具体用法?C# Struct.Equals怎么用?C# Struct.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Struct
的用法示例。
在下文中一共展示了Struct.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dfs
public static List<Struct.DoubleIndex> Dfs(char [,] map, Struct.DoubleIndex current, Struct.DoubleIndex target, char wall, bool isNew = true)
{
if (isNew) {
currentPath.Clear ();
bestPath = null;
}
currentPath.Insert (0, current.Clone());
if (current.Equals (target) && (bestPath == null || bestPath.Count > currentPath.Count))
bestPath = new List<Struct.DoubleIndex> (currentPath);
if (bestPath != null && bestPath.Count <= currentPath.Count)
return bestPath;
for (int i = 0; i < directionsX.Length; i++) {
current.first += directionsY[i];
current.second += directionsX[i];
if(!currentPath.Contains(current) && CanMove(map, current, wall))
Dfs (map, current, target, wall, false);
current.first -= directionsY[i];
current.second -= directionsX[i];
}
currentPath.RemoveAt (0);
return bestPath;
}
示例2: Main
static void Main(string[] args)
{
TestEnv.TestEnv te= new TestEnv.TestEnv();
te.CheckComplainAndAdjustExpected( 0);
Struct s = new Struct();
dlgt_vv aDlgt0 = s.foo;
dlgt_vv aDlgt = s.foo;
te.Test( 0== ( (Struct)aDlgt.Target).i);
Struct sCopy1= (Struct) aDlgt.Target;
te.Test( s.Equals( sCopy1)); // bb86f83d6448458db598c5fa849441c8
te.Test( aDlgt.Target.Equals( ( (dlgt_vv) s.foo).Target)); // 6494647464964967a30d5f91c399c818
te.Test( ! aDlgt.Equals( ( (dlgt_vv) s.foo)));
te.Test( ! aDlgt0.Equals( aDlgt));
aDlgt();
//s.foo(); // not the same Result
Struct sCopy2= (Struct) aDlgt.Target; // 109ea2c9d5584c15854be335d0b81884
te.Test( ! s.Equals( sCopy2)); // bb86f83d6448458db598c5fa849441c8
te.Test( ! aDlgt.Target.Equals( ( (dlgt_vv) s.foo).Target)); // 6494647464964967a30d5f91c399c818
te.Test( 0 == s.i);
te.Test( 0 == sCopy1.i);
te.Test( 1 == sCopy2.i); // 109ea2c9d5584c15854be335d0b81884
te.CheckComplainAndAdjustExpected( 10);
System.Console.WriteLine( te.Result());
}