ExpressionEvaluator
                                
                                 ExpressionEvaluator copied to clipboard
                                
                                    ExpressionEvaluator copied to clipboard
                            
                            
                            
                        [Suggestion] AssignVariable in Script Evaluation (Not in Declraration)
[CASE] 0. Declare Variable First uint value = 1;
- 
The variable type is unit at this point. 
- 
Assign a value to it value = 10; 
- 
Now the type of 'value' is int (as engine evaluates 1 as int) 
- 
Variable type changed. 
[Solution] Change AssignVariable method:
        if (Variables.ContainsKey(varName) && Variables[varName] is StronglyTypedVariable stronglyTypedVariable)
        {
                  ...
        }
        else
        {
            try
            {
                if (Variables[varName].GetType() == value.GetType())
                {
                    Variables[varName] = value;
                }
                else
                {
                    Variables[varName] = Convert.ChangeType(value, Variables[varName].GetType());
                }
            }
            catch (Exception exception)
            {
                throw new InvalidCastException(exception.Message, exception);
            }
        }