1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 03:58:01 +02:00

Fixed explicit interface indexer

This commit is contained in:
Brian Fiete 2024-11-20 14:05:42 -05:00
parent 908a76b92a
commit 295057b026
2 changed files with 32 additions and 1 deletions

View file

@ -109,6 +109,22 @@ namespace Tests
}
}
class IndexTestExplicit : IIndexable<float>
{
public float IIndexable<float>.this[int index]
{
get
{
return index;
}
set
{
}
}
}
public static float Get<T>(T indexable) where T : IIndexable<float>
{
float f = indexable[4];
@ -147,6 +163,10 @@ namespace Tests
IndexTest it = scope .();
Test.Assert(it[5] == 5.0f);
Test.Assert(Get(it) == 4);
IndexTestExplicit it2 = scope .();
Test.Assert(Get(it2) == 4);
}
}
}