小编Bur*_*rak的帖子

IText7 在 .NET 5 上抛出 FileNotFoundException

IText7 Version : 7.1.14

我们检测到无法在 .NET 5 中使用 IText7:

private byte[] BuildPDF()
{
   using(var stream = new MemoryStream())
   {
        PdfDocument pdfDoc = new PdfDocument(new PdfWriter(stream));
        Document doc = new Document(pdfDoc);

        Table table = new Table(UnitValue.CreatePercentArray(8)).UseAllAvailableWidth();

        for (int i = 0; i < 16; i++)
        {
           table.AddCell("hi");
        }

       doc.Add(table);

       doc.Close();
   
       return stream.ToArray();
   }
}
Run Code Online (Sandbox Code Playgroud)

这个简单的代码适用于 .NET Core 3.1 项目,但不适用于.NET 5 项目。

抛出Exception如下:

An unhandled exception occurred while processing the request.
FileNotFoundException: Could not load file or assembly …
Run Code Online (Sandbox Code Playgroud)

.net itext .net-core itext7 .net-core-3.1

1
推荐指数
1
解决办法
978
查看次数

List.Where("string".Contains()) 在 LINQ 查询中返回 NULL

我的Product班级:

public class Product {
 public int Id { get; set; }
 public string NameEnglish { get; set; }
 public string NameItalian { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的Language班级:

public class Language{
  public int Id { get; set; }
  public string LanguageType { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我有一个使用“名称”属性在产品中搜索并返回的方法List<Product>

List<Product> GetProductsFromSearch(int languageId, string searchedData){
    var products = _contex.Products.ToList();
    switch(languageId) //LanguageId 1 = English , LangaugeId 2 = Italian
    {
       case 1:
            return products.Where(i=>i.NameEnglish.Contains(searchedData)).ToList();
       case 2:
            return …
Run Code Online (Sandbox Code Playgroud)

.net c# linq entity-framework

0
推荐指数
1
解决办法
705
查看次数

标签 统计

.net ×2

.net-core ×1

.net-core-3.1 ×1

c# ×1

entity-framework ×1

itext ×1

itext7 ×1

linq ×1