Пример #1
0
        public object Deserialize(OclDocument document, Type type)
        {
            var context = new OclConversionContext(options);
            var result  = context.FromElement(type, document, null);

            if (result == null)
            {
                throw new OclException("Document conversion resulted in null, which is not valid");
            }
            return(result);
        }
Пример #2
0
        public string Serialize(OclDocument document)
        {
            var sb = new StringBuilder();

            // ReSharper disable once ConvertToUsingDeclaration
            using (var writer = new OclWriter(sb, options))
            {
                writer.Write(document);
            }

            return(sb.ToString());
        }
Пример #3
0
 public T Deserialize <T>(OclDocument document) where T : notnull
 => (T)Deserialize(document, typeof(T));