System.Collections.Generic.List.Add(s)

Here are the examples of the csharp api System.Collections.Generic.List.Add(s) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : ExporterTxm.cs
License : GNU Affero General Public License v3.0
Project Creator : notesjor

public override void Export(IHydra hydra, string path)
    {
      if (!Directory.Exists(path))
        Directory.CreateDirectory(path);

      lock (_templateLock)
        if (_template == null)
          InitTemplate(hydra.LayerDisplaynames);

      int id;
      foreach (var dsel in hydra.DoreplacedentGuids)
      {
        lock (_docCountLock)
          id = _docCount++;

        var multi =
          hydra.GetReadableMultilayerDoreplacedent(dsel)
               .ToDictionary(x => x.Key,
                             x => x.Value.Select(y => y.ToArray()).ToArray());

        var first = multi["Wort"];
        multi.Remove("Wort");

        var wid = 0;
        var sentences = new List<s>();
        for (var i = 0; i < first.Length; i++)
        {
          var ws = new List<object>();
          for (int j = 0; j < first[i].Length; j++)
          {
            ws.Add(new w
            {
              id = $"w_{id}_{++wid}",
              form = first[i][j],
              ana = multi.Select(l => new ana { type = $"#{l.Key.ToLower().Replace(" ", "")}", resp = "#txm", Text = l.Value.Length <= i ? string.Empty : l.Value[i].Length <= j ? string.Empty : l.Value[i][j] }).ToArray()
            });
          }

          sentences.Add(new s { Items = ws.ToArray() });
        }

        lock (_templateLock)
        {
          var tei = _template;
          tei.text = new text
          {
            id = id.ToString(),
            p = new p[]
            {
              new p
              {
                s = sentences.ToArray()
              }
            }
          };
          XmlSerializerHelper.Serialize(tei, Path.Combine(path, $"{id:D5}.xml"));
        }
      }
    }