本文整理汇总了C#中Range.Encompass方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Encompass方法的具体用法?C# Range.Encompass怎么用?C# Range.Encompass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.Encompass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encompass_value
public void encompass_value() {
var a = new Range(1, 2);
var b = new Range(1.5);
var c = new Range(3);
Assert.Equal(a, a.Encompass(b));
Assert.Equal(a, b.Encompass(a));
Assert.Equal(new Range(1.5, 3), b.Encompass(c));
Assert.Equal(new Range(1.5, 3), c.Encompass(b));
Assert.Equal(new Range(1, 3), a.Encompass(c));
Assert.Equal(new Range(1, 3), c.Encompass(a));
}
示例2: encompass_range
public void encompass_range() {
var a = new Range(1, 2);
var b = new Range(1.5, 2.5);
var c = new Range(1.25, 1.75);
var d = new Range(3, 4);
Assert.Equal(new Range(1, 2.5), a.Encompass(b));
Assert.Equal(new Range(1, 2.5), b.Encompass(a));
Assert.Equal(a, a.Encompass(c));
Assert.Equal(a, c.Encompass(a));
Assert.Equal(new Range(1, 4), a.Encompass(d));
Assert.Equal(new Range(1, 4), d.Encompass(a));
Assert.Equal(new Range(1.25, 2.5), b.Encompass(c));
Assert.Equal(new Range(1.25, 2.5), c.Encompass(b));
Assert.Equal(new Range(1.5, 4), b.Encompass(d));
Assert.Equal(new Range(1.5, 4), d.Encompass(b));
Assert.Equal(new Range(1.25, 4), c.Encompass(d));
Assert.Equal(new Range(1.25, 4), d.Encompass(c));
}
示例3: emcompass_value_for_value_range
public void emcompass_value_for_value_range() {
var a = new Range(1);
var b = new Range(2);
var c = new Range(2);
Assert.Equal(new Range(1, 2), a.Encompass(b));
Assert.Equal(new Range(1, 2), b.Encompass(a));
Assert.Equal(new Range(2), b.Encompass(c));
}