예제 #1
0
        public static object ParseQuotedPrimitive(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            var unescapeString = Serializer.UnescapeString(value);

            if (value != unescapeString)
            {
                return(unescapeString);
            }

#if NET40
            Guid guidValue;
            if (Guid.TryParse(value, out guidValue))
            {
                return(guidValue);
            }
#endif
            DateTime dateTimeValue;
            if (DateTimeSerializer.TryParseShortestXsdDateTime(value, out dateTimeValue))
            {
                return(dateTimeValue);
            }
            DateTimeOffset dateTimeOffsetValue;
            if (DateTimeSerializer.TryParseDateTimeOffset(value, out dateTimeOffsetValue))
            {
                return(dateTimeOffsetValue);
            }

            return(value);
        }