本文整理汇总了C#中System.Windows.Vector.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.Equals方法的具体用法?C# Vector.Equals怎么用?C# Vector.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Vector
的用法示例。
在下文中一共展示了Vector.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Equals
public void Equals ()
{
Vector v = new Vector (4, 5);
Assert.IsTrue (v.Equals (new Vector (4, 5)));
Assert.IsFalse (v.Equals (new Vector (5, 4)));
Assert.IsFalse (v.Equals (new object()));
}
示例2: Equals
public static bool Equals (Vector vector1, Vector vector2)
{
return vector1.Equals (vector2);
}
示例3: PerformOperation
//.........这里部分代码省略.........
// Declaring vector2 without initializing x,y values
var vector2 = new System.Windows.Vector
{
X = 45,
Y = 70
};
// Boolean to hold the result of the comparison
// assigning values to vector2
// Comparing Vectors for equality
var areEqual = (vector1 == vector2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = (vector1 == vector2);";
resultType = "Boolean";
operationString = "Checking if two vectors are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb25":
{
// Checks if two Vectors are equal using the static Equals method.
var vector1 = new System.Windows.Vector(20, 30);
var vector2 = new System.Windows.Vector(45, 70);
var areEqual = System.Windows.Vector.Equals(vector1, vector2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = Vector.Equals(vector1, vector2);";
resultType = "Boolean";
operationString = "Checking if two vectors are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb26":
{
// Compares an Object and a Vector for equality using the non-static Equals method.
var vector1 = new System.Windows.Vector(20, 30);
var vector2 = new System.Windows.Vector(45, 70);
var areEqual = vector1.Equals(vector2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = vector1.Equals(vector2);";
resultType = "Boolean";
operationString = "Checking if two vectors are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb27":
{
示例4: PerformOperation
//.........这里部分代码省略.........
// Displaying Results
resultType = "Point";
syntaxString = "pointResult = Point.Multiply(point1, matrix1);";
operationString = "Multiplying a Point by a Matrix";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb10":
{
// Checks if two Points are equal using the overloaded equality operator.
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
Boolean areEqual;
areEqual = (point1 == point2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = (point1 == point2);";
resultType = "Boolean";
operationString = "Checking if two points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb11":
{
// Checks if two Points are equal using the static Equals method.
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
Boolean areEqual;
areEqual = Point.Equals(point1, point2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = Point.Equals(point1, point2);";
resultType = "Boolean";
operationString = "Checking if two points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb12":
{
// Compares an Object and a Point for equality using the non-static Equals method.
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
Boolean areEqual;
areEqual = point1.Equals(point2);
// areEqual is False
// Displaying Results
syntaxString = "areEqual = point1.Equals(point2);";
resultType = "Boolean";
operationString = "Checking if two points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb13":
{
// Compares an Object and a Vector for equality using the non-static Equals method.
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);