Esempio n. 1
0
 public FixedLengthResult(IFixedLengthTypeMapper <T> mapper, IEnumerable <T> data, FixedLengthOptions options = null, string fileName = null, string contentType = null)
 {
     if (mapper == null)
     {
         throw new ArgumentNullException("mapper");
     }
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (options == null)
     {
         options = new FixedLengthOptions();
     }
     if (String.IsNullOrWhiteSpace(fileName))
     {
         fileName = "file.txt";
     }
     if (contentType == null)
     {
         contentType = "text/plain";
     }
     this.writer      = mapper.ToWriter(data);
     this.options     = options;
     this.fileName    = fileName;
     this.contentType = contentType;
 }
Esempio n. 2
0
 public FixedLengthResult(IFixedLengthTypeWriter <T> writer, FixedLengthOptions options = null, string fileName = null, string contentType = null)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (options == null)
     {
         options = new FixedLengthOptions();
     }
     if (String.IsNullOrWhiteSpace(fileName))
     {
         fileName = "file.txt";
     }
     if (contentType == null)
     {
         contentType = "text/plain";
     }
     this.writer      = writer;
     this.options     = options;
     this.fileName    = fileName;
     this.contentType = contentType;
 }