Exemplo n.º 1
0
 public T As <T>()
 {
     if (!CurrentValue.GetType().IsAssignableFrom(typeof(T)) && World.Instance.Ktd.ContainsType(Type.Name))
     {
         KtdType typeAsKtdType = World.Instance.Ktd.GetKtdType(Type.Name);
         Type    t             = typeof(T);
         return((T)typeAsKtdType.AssignValuesToNativeType(Value, t));
     }
     else
     {
         return((T)Value);
     }
 }
Exemplo n.º 2
0
        private object convertValueToAttributeType(object value)
        {
            if (value == null || value.GetType() == this.Type)
            {
                return(value);
            }

            if (World.Instance.Ktd != null && World.Instance.Ktd.ContainsType(this.Type.Name))
            {
                KtdType typeAsKtdType = World.Instance.Ktd.GetKtdType(this.Type.Name);
                return(typeAsKtdType.AssignValuesToNativeType(value, this.Type));
            }

            return(Convert.ChangeType(value, this.Type));
        }