Exemplo n.º 1
0
        public dynamic Parse(ArgumentInfo argumentInfo)
        {
            dynamic value        = _singleValueParser.ParseString(argumentInfo.ValueInfo.Value, argumentInfo.IsImplicit, argumentInfo.TypeDisplayName);
            Type    nullableType = typeof(Nullable <>).MakeGenericType(_type);
            object  instance     = Activator.CreateInstance(nullableType, new[] { value });

            return(instance);
        }
Exemplo n.º 2
0
        public dynamic Parse(ArgumentInfo argumentInfo)
        {
            Type  listType     = typeof(List <>).MakeGenericType(_underLyingType);
            IList listInstance = (IList)Activator.CreateInstance(listType);

            foreach (string stringValue in argumentInfo.ValueInfo.Values)
            {
                dynamic value = _singleValueParser.ParseString(stringValue, argumentInfo.IsImplicit, argumentInfo.TypeDisplayName);
                listInstance.Add(value);
            }

            return(listInstance);
        }