mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
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:
@@ -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()}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user