public static IEnumerable <Tuple <Corner, T> > Where <T>(this Corners <T> self, Func <Corner, T, bool> predicate) { if (predicate(Corner.LeftBottom, self.LeftBottom)) { yield return(Tuple.Create(Corner.LeftBottom, self.LeftBottom)); } if (predicate(Corner.LeftTop, self.LeftTop)) { yield return(Tuple.Create(Corner.LeftTop, self.LeftTop)); } if (predicate(Corner.RightBottom, self.RightBottom)) { yield return(Tuple.Create(Corner.RightBottom, self.RightBottom)); } if (predicate(Corner.RightTop, self.RightTop)) { yield return(Tuple.Create(Corner.RightTop, self.RightTop)); } }
public static bool CornersAreEqual <T>(this Corners <T> self) { return(self.LeftBottom.Equals(self.LeftTop) && self.LeftTop.Equals(self.RightBottom) && self.RightBottom.Equals(self.RightTop)); }
public static Corners <T> Inverse <T>(this Corners <T> self) where T : INumeric <T> { return(self.Select(t => t.Inverse())); }