1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Improved constraint checks where generic param type constraint passes

This commit is contained in:
Brian Fiete 2025-05-28 11:57:28 +02:00
parent 116d9c6f01
commit b7725d0ed0
4 changed files with 76 additions and 1 deletions

View file

@ -7,6 +7,19 @@ namespace Tests
{
class Constraints
{
struct Vector2<T>
{
public T mX;
public T mY;
}
extension Vector2<T> where T : float
{
public T LengthSquared => mX * mX + mY * mY;
public T Length => Math.Sqrt(LengthSquared);
public T NegX = -mX;
}
class Dicto : Dictionary<int, float>
{