示例#1
0
 public bool TryDecode <T>(PyObject pyObj, out T value)
 {
     if (!PyDict.IsDictType(pyObj))
     {
         value = default;
         return(false);
     }
     using (var pyDict = new PyDict(pyObj))
     {
         if (typeof(T).IsGenericType)
         {
             value = pyDict.ToDictionary <T>();
         }
         else
         {
             value = (T)pyDict.ToDictionary();
         }
         return(true);
     }
 }