Exemple #1
0
 public dynamic getTypeCastedFeatureValue(dynamic value, string variableType)
 {
     try
     {
         if (value.GetType().Name == Constants.DotnetVariableTypes.VALUES[variableType])
         {
             return(value);
         }
         if (variableType == Constants.VariableTypes.STRING)
         {
             return(Convert.ToString(value));
         }
         if (variableType == Constants.VariableTypes.INTEGER)
         {
             return(Convert.ToInt32(value));
         }
         if (variableType == Constants.VariableTypes.DOUBLE)
         {
             return(Convert.ToDouble(value));
         }
         if (variableType == Constants.VariableTypes.BOOLEAN)
         {
             return(Convert.ToBoolean(value));
         }
         return(value);
     }
     catch
     {
         LogErrorMessage.UnableToTypeCast(typeof(IVWOClient).FullName, value, variableType, value.GetType().Name);
         return(null);
     }
 }