Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Unassigned: Overload resolution not working with indexed property [25]

$
0
0
When an class have overloaded indexed property,
overload resolution with the property does not work.

class definition (C#)
```
public class MyDictionary
{
public Object this[Int32 index]
{
get { return this.GetItemByIndex(index); }
}
public String this[String name]
{
get { return this.GetItemByName(name); }
}
// ...
}
```

Code execution
```
var engine = new V8ScriptEngine();
var dic = new MyDictionary();
engine.AddHostObject("dic", dic);

engine.Execute("dic.Item.get(0);"); // works
engine.Execute("dic.Item.get('name');"); // throws ScriptEngineException
```
Comments: Support for indexed property overload resolution was added in ClearScript 5.3.8. We've tested your code above and could not reproduce any issue once we added trivial `GetItemByIndex` and `GetItemByName` methods. Please make sure you have ClearScript 5.3.8 or later. If you have the source code, see the file Version.tt. If you only have binaries, you can see the version number in the Details property page for any of the ClearScript DLLs.

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images