コード例 #1
0
ファイル: Serializer.cs プロジェクト: vfioox/ENULib
 /// <summary>
 /// Constructs a serializer to (de)serialize the given type using the
 /// specified configuration section.
 /// </summary>
 /// <param name="t">the type to serialize/deserialize</param>
 public Serializer(Type type, string configSection)
 {
     if (type == null)
         throw new ArgumentNullException("type");
     _serializedType = type;
     _context = new SerializationContext();
     _context.SerializerInstance = this;
     XmlConfigurator.Configure(_context, configSection);
 }
コード例 #2
0
ファイル: Serializer.cs プロジェクト: vfioox/ENULib
        /// <summary>
        /// Constructs a serializer with an existing context  to (de)serialize the given type
        /// </summary>
        /// <param name="t">the type to serialize/deserialize</param>
        /// <param name="context"></param>
        public Serializer(Type type, SerializationContext context)
        {
            if (type == null)
                throw new ArgumentNullException("type");
            if (context == null)
                throw new ArgumentNullException("context");

            _serializedType = type;
            _context = context;
            _context.SerializerInstance = this;
        }
コード例 #3
0
ファイル: Serializer.cs プロジェクト: vfioox/ENULib
 public static Serializer GetSerializer(Type type, SerializationContext context)
 {
     return new Serializer(type, context);
 }