Example #1
0
 public object ConvertToValidMemberValue(TypeSet types, object v)
 {
     TypeDef td = types.GetTypeDef(this.TypeName);
     if (this.IsArray)
     {
         List<object> ret = new List<object>();
         IEnumerable enu = v as IEnumerable;
         if (enu != null)
         {
             foreach (object v2 in enu)
                 ret.Add(td.ConvertToValidType(v2));
         }
         else
         {
             ret.Add(td.ConvertToValidType(v));
         }
         return ret;
     }
     else
         return td.ConvertToValidType(v);
 }
Example #2
0
 /// <summary>
 /// Import types from given typeset.
 /// Does not import already existing types.
 /// </summary>
 /// <param name="sourceTypeSet"></param>
 public void ImportTypes(TypeSet sourceTypeSet)
 {
     foreach (string tn in sourceTypeSet.TypeNames)
     {
         TypeDef td = sourceTypeSet.GetTypeDef(tn);
         if (!IsTypeDefined(td.Name))
             ImportType(td);
     }
 }