예제 #1
0
		public static void Serialize<T, TDoc, TCursor>(IO.TagElementStream<TDoc, TCursor, string> s,
			Collections.BListAutoId<T> list, BListXmlParams @params, bool forceNoRootElementStreaming = false)
			where T : class, Collections.IListAutoIdObject, new()
			where TDoc : class
			where TCursor : class
		{
			Contract.Requires(s != null);
			Contract.Requires(list != null);
			Contract.Requires(@params != null);

			if (forceNoRootElementStreaming) @params.SetForceNoRootElementStreaming(true);
			using (var xs = CreateXmlSerializer(list, @params))
			{
				xs.Serialize(s);
			}
			if (forceNoRootElementStreaming) @params.SetForceNoRootElementStreaming(false);
		}
예제 #2
0
        public static void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                     Collections.BTypeNames list, BListXmlParams @params, bool forceNoRootElementStreaming = false)
            where TDoc : class
            where TCursor : class
        {
            Contract.Requires(s != null);
            Contract.Requires(list != null);
            Contract.Requires(@params != null);

            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(true);
            }
            using (var xs = new BTypeNamesXmlSerializer(@params, list))
            {
                xs.Serialize(s);
            }
            if (forceNoRootElementStreaming)
            {
                @params.SetForceNoRootElementStreaming(false);
            }
        }