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:
parent
908a76b92a
commit
295057b026
2 changed files with 32 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue