Esempio n. 1
0
        public T GetValue <T>()
        {
            DocumentNodeStringValue documentNodeStringValue = this.value as DocumentNodeStringValue;

            if (documentNodeStringValue != null)
            {
                string str = documentNodeStringValue.Value;
                if (str != null)
                {
                    return(this.ConvertFromString <T>(str));
                }
            }
            return(default(T));
        }
Esempio n. 2
0
        public Uri GetUriValue()
        {
            DocumentNodeStringValue documentNodeStringValue = this.value as DocumentNodeStringValue;

            if (documentNodeStringValue != null)
            {
                string uriString = documentNodeStringValue.Value;
                Uri    result;
                if (!string.IsNullOrEmpty(uriString) && Uri.TryCreate(uriString, UriKind.RelativeOrAbsolute, out result))
                {
                    return(result);
                }
            }
            return((Uri)null);
        }
Esempio n. 3
0
        public static string GetValueAsString(DocumentNode node)
        {
            DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode;

            if (documentPrimitiveNode != null && documentPrimitiveNode.TypeResolver.PlatformMetadata.KnownTypes.String.IsAssignableFrom((ITypeId)documentPrimitiveNode.Type))
            {
                DocumentNodeStringValue documentNodeStringValue = documentPrimitiveNode.value as DocumentNodeStringValue;
                if (documentNodeStringValue != null)
                {
                    return(documentNodeStringValue.Value);
                }
                DocumentPrimitiveNode.UnsitedValue unsitedValue = documentPrimitiveNode.value as DocumentPrimitiveNode.UnsitedValue;
                if (unsitedValue != null)
                {
                    return((string)unsitedValue.Value);
                }
            }
            return((string)null);
        }