예제 #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);
 }