コード例 #1
0
        /// <summary>
        /// Serializes the specified o.
        /// </summary>
        /// <param name="o">The o.</param>
        /// <param name="sb">The sb.</param>
        public override void Serialize(object o, StringBuilder sb)
        {
            DataView dv = o as DataView;

            if(dv == null)
                throw new NotSupportedException();

            DataTableConverter dtc = new DataTableConverter();
            #if(NET20)
            dtc.Serialize(dv.ToTable(), sb);
            #else
            DataTable dt = dv.Table.Clone();
            //dt.Locale = dv.Table.Locale;
            //dt.CaseSensitive = dv.Table.CaseSensitive;
            //dt.TableName = dv.Table.TableName;
            //dt.Namespace = dv.Table.Namespace;
            //dt.Prefix = dv.Table.Prefix;

            for(int i=0; i<dv.Count; i++)
            {
                dt.ImportRow(dv[i].Row);
            }

            dtc.Serialize(dt, sb);
            #endif
        }