Add Extension method to help use PropertyMap class
authorSeungkeun Lee <sngn.lee@samsung.com>
Wed, 7 Apr 2021 02:40:49 +0000 (11:40 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 20 Apr 2021 06:13:00 +0000 (15:13 +0900)
src/Tizen.NUI/src/public/Common/PropertyMap.cs [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index ec0f914..42a07c8
@@ -317,4 +317,25 @@ namespace Tizen.NUI
             Interop.PropertyMap.DeletePropertyMap(swigCPtr);
         }
     }
+
+    internal static class PropertyMapSetterHelper
+    {
+        internal static PropertyMap Add<T>(this PropertyMap propertyMap, int key, T value)
+        {
+            using (var pv = PropertyValue.CreateFromObject(value))
+            {
+                propertyMap.Add(key, pv);
+            }
+            return propertyMap;
+        }
+
+        internal static PropertyMap Add<T>(this PropertyMap propertyMap, string key, T value)
+        {
+            using (var pv = PropertyValue.CreateFromObject(value))
+            {
+                propertyMap.Add(key, pv);
+            }
+            return propertyMap;
+        }
+    }
 }