コード例 #1
0
        private string HandleFromRam(string variableName)
        {
            var new_source = variableName.Split(':');
            var name       = new_source.ElementAtOrDefault(1); //Name
            var value      = new_source.ElementAtOrDefault(2); //Value
            var type       = new_source.ElementAtOrDefault(3); //Type
            var to_put     = Ram.FirstOrDefault(s => s.Name == name);
            var convert    = Conversion.GetConversion(Type.GetType(type));

            if (to_put == null)
            {
                throw new NotDefinedVariableException(string.Format("The varible {0} is not defined", name));
            }
            else
            {
                if (convert.Any(s => s == PossibleConversion.IStringable))
                {
                    dynamic c = to_put;
                    return(c.ToMemoryString());
                }
                else if (convert.Any(s => s == PossibleConversion.IConvertible))
                {
                    return(Convert.ToString(to_put.IncapsulatedValue));
                }
                else
                {
                    return(to_put.IncapsulatedValue.ToString());
                }
            }
        }