Serialize Dictionary type to V8 object (#2303)

* Serialize Dictionary type to V8 object

Handle Dictionary type, otherwise it will be treated as class/structs and cause exception.

* Make the testcase covert IDictionary interface & ensure consistent bracket style.
This commit is contained in:
WarWithinMe
2018-03-22 09:00:52 +08:00
committed by amaitland
parent 58e705244b
commit 1542fa3cfc
3 changed files with 103 additions and 0 deletions
+29
View File
@@ -3,6 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
@@ -98,5 +99,33 @@ namespace CefSharp.Example
return builder.ToString();
}
public Dictionary<string, int> MethodReturnsDictionary1()
{
return new Dictionary<string, int>()
{
{"five", 5},
{"ten", 10}
};
}
public Dictionary<string, object> MethodReturnsDictionary2()
{
return new Dictionary<string, object>()
{
{"onepointfive", 1.5},
{"five", 5},
{"ten", "ten"},
{"twotwo", new Int32[]{2, 2} }
};
}
public Dictionary<string, IDictionary> MethodReturnsDictionary3()
{
return new Dictionary<string, IDictionary>()
{
{"data", MethodReturnsDictionary2()}
};
}
}
}