summaryrefslogtreecommitdiff
path: root/modules/mono/glue/cs_files/MarshalUtils.cs
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2018-07-18 23:07:57 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2018-07-20 01:44:30 +0200
commitee3c476c9a8a3be949252468570e75f35fea2697 (patch)
tree2baeb0d948acb10fc15f15c026ef9af0699d2ce8 /modules/mono/glue/cs_files/MarshalUtils.cs
parent2f69e36cef8acca00ec5445f4aa8ec538bb38e3e (diff)
Add Array and Dictionary wrapper classes to C#
Diffstat (limited to 'modules/mono/glue/cs_files/MarshalUtils.cs')
-rw-r--r--modules/mono/glue/cs_files/MarshalUtils.cs29
1 files changed, 5 insertions, 24 deletions
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs
index ff4477cc6c..6ad4b3dcb2 100644
--- a/modules/mono/glue/cs_files/MarshalUtils.cs
+++ b/modules/mono/glue/cs_files/MarshalUtils.cs
@@ -1,36 +1,17 @@
using System;
-using System.Collections.Generic;
namespace Godot
{
- internal static class MarshalUtils
+ static class MarshalUtils
{
- private static Dictionary<object, object> ArraysToDictionary(object[] keys, object[] values)
+ static bool IsArrayGenericType(Type type)
{
- var ret = new Dictionary<object, object>();
-
- for (int i = 0; i < keys.Length; i++)
- {
- ret.Add(keys[i], values[i]);
- }
-
- return ret;
- }
-
- private static void DictionaryToArrays(Dictionary<object, object> from, out object[] keysTo, out object[] valuesTo)
- {
- var keys = from.Keys;
- keysTo = new object[keys.Count];
- keys.CopyTo(keysTo, 0);
-
- var values = from.Values;
- valuesTo = new object[values.Count];
- values.CopyTo(valuesTo, 0);
+ return type.GetGenericTypeDefinition() == typeof(Array<>);
}
- private static Type GetDictionaryType()
+ static bool IsDictionaryGenericType(Type type)
{
- return typeof(Dictionary<object, object>);
+ return type.GetGenericTypeDefinition() == typeof(Dictionary<, >);
}
}
}